Skip to content
Tcl Source Code History Of Ticket 1746193fffffffff
Login

History Of Ticket 1746193fffffffff

Artifacts Associated With Ticket 1746193fffffffff

  1. Ticket change [30ee18d61b] (rid 93338) by andygoth on 2007-07-01 21:44:08:

    1. assignee initialized to: "dkf"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      In the Chicago (Central) time zone, [clock add] can miscalculate month addition and subtraction:
      
      [clock format [clock add [clock scan "May 01 00:00:00 1970" -timezone :UTC] 1 month] -timezone :UTC]
      returns "Sun May 31 00:00:00 UTC 1970"
      
      [clock format [clock add [clock scan "May 31 00:00:00 1970" -timezone :UTC] -1 month] -timezone :UTC]
      returns "Fri May 01 00:00:00 UTC 1970"
      
      Changing the time zone to UTC or CEST fixes the problem:
      
      [clock format [clock add [clock scan "May 01 00:00:00 1970" -timezone :UTC] 1 month] -timezone :UTC]
      returns "Mon Jun 01 00:00:00 UTC 1970"
      
      Probably other time zones work as well.  It's also possible other time zones are broken.  It could be that the Chicago time zone is only broken when in Daylight Saving time.
      
      This occurs in both Slackware Linux and MS-Windows XP.
      
    4. foundin initialized to: "obsolete: 8.5a7"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "andygoth"
    10. subsystem initialized to: "16. Commands A-H"
    11. title initialized to: "[clock add] month miscalculation in Chicago time"
    12. type initialized to: "Bug"
  2. Ticket change [9174197b82] (rid 120619) by andygoth on 2007-07-02 04:48:04:

    1. assignee changed to: "kennykb"
    2. icomment:
      Logged In: YES 
      user_id=8653
      Originator: YES
      
      This problem exists in today's HEAD.
      
      
    3. login: "andygoth"
    4. mimetype: "text/plain"
    5. username: "andygoth"
  3. Ticket change [f02d74bb33] (rid 109142) by andygoth on 2007-07-02 05:17:03:

    1. icomment:
      Logged In: YES 
      user_id=8653
      Originator: YES
      
      The problem appears to be in [clock add].  [clock scan] and [clock format] generate the right results, of course assuming GNU date is right. :^)
      
      [clock add 12960000 -1 month] returns 10368000, which is May 1.  It should return 10281600, or Apr 30.  The two values differ by 86400, one day.
      
      Hmm, come to think of it... [clock add] takes a -timezone argument as well.  Passing in -timezone :UTC to [clock add] makes it return 10281600, the expected result.  I'm unsure why the -timezone argument matters in this case, though.  This may still bear investigation.
      
      
    2. login: "andygoth"
    3. mimetype: "text/plain"
    4. username: "andygoth"
  4. Ticket change [5c3a2b6cac] (rid 115262) by dkf on 2007-07-02 06:15:59:

    1. subsystem changed to: "06. Time Measurement"
  5. Ticket change [de9483c31a] (rid 114875) by kennykb on 2007-09-04 03:56:11:

    1. closedate changed to: "2007-09-03T20:56:11"
    2. closer changed to: "kennykb"
    3. icomment:
      Logged In: YES 
      user_id=99768
      Originator: NO
      
      I can't find a bug here.
      
      [clock add] operates in the given timezone - in your case :America/Chicago.
      
      In Chicago time, 12960000 is Sat May 30 19:00:00 CDT 1970
      Subtracting 1 month yields 
      
      % clock add 12960000 -1 month -timezone :America/Chicago
      10368000
      % clock format 10368000 -timezone :America/Chicago
      Thu Apr 30 19:00:00 CDT 1970
      
      which is 1 month before the given date in Chicago time.
      
      By contrast, in UTC, we have:
      
      % clock format 12960000 -gmt 1
      Sun May 31 00:00:00 GMT 1970
      
      Subtracting 1 month yields the invalid date April 31, which gets trimmed to April 30:
      
      % clock add 12960000 -1 month -gmt 1
      10281600
      % clock format 10281600 -gmt 1
      Thu Apr 30 00:00:00 GMT 1970
      
      All of which is exactly as I expect.
      
      
    4. login: "kennykb"
    5. mimetype: "text/plain"
    6. resolution changed to: "Invalid"
    7. status changed to: "Pending"
    8. username: "kennykb"
  6. Ticket change [bf76dad3bf] (rid 102257) by sf-robot on 2007-09-18 09:20:05:

    1. closedate changed to: "2007-09-18T02:20:05"
    2. closer changed to: "sf-robot"
    3. icomment:
      Logged In: YES 
      user_id=1312539
      Originator: NO
      
      This Tracker item was closed automatically by the system. It was
      previously set to a Pending status, and the original submitter
      did not respond within 14 days (the time period specified by
      the administrator of this Tracker).
      
      
    4. login: "sf-robot"
    5. mimetype: "text/plain"
    6. status changed to: "Closed"
    7. username: "sf-robot"