Skip to content
Tcl Source Code History Of Ticket aa082a279c5d3a39
Login

History Of Ticket aa082a279c5d3a39

Artifacts Associated With Ticket aa082a279c5d3a39

  1. Ticket change [1c0ae34bfb] (rid 146829) by karl on 2016-05-27 18:04:55:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      The latest FreeBSD zoneinfo file for Asia/Tehran can be used to produce times referencing the IRDT timezone but when trying to use it in Tcl, it's an error.
      
      The problematic file can be downloaded from http://karl.flightaware.com/playpen/zoneinfo/Asia/Tehran
      
    5. foundin initialized to: "8.6.5"
    6. is_private initialized to: "0"
    7. login: "karl"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "8e87430d20c719bc0781e97e9eb4e938480cca76"
    10. resolution initialized to: "None"
    11. severity initialized to: "Important"
    12. status initialized to: "Open"
    13. submitter initialized to: "karl"
    14. subsystem initialized to: "06. Time Measurement"
    15. title initialized to:
      clock format "time zone not found" with valid zoneinfo file
      
    16. type initialized to: "Bug"
  2. Ticket change [71e7771330] (rid 146833) by dgp on 2016-05-31 15:40:02:

    1. assignee changed to: "kbk"
    2. login: "dgp"
    3. mimetype: "text/plain"
  3. Ticket change [53cc6f487a] (rid 146899) by karl on 2016-06-03 17:13:58:

    1. icomment:
      I think the main problem is it should pass $date and not $y to IsGregorianLeapYear.  This diff seems to fix the problem, but it sets Gregorian to 1 and thus may malfunction for dates before September of 1752:
      
      --- /usr/local/lib/tcl8.6/clock.tcl	2016-03-01 13:51:46.077512000 +0000
      +++ clock.tcl	2016-06-03 14:51:42.050504100 +0000
      @@ -3881,14 +3881,14 @@
       
           # Determine the start or end day of DST
       
      -    set date [dict create era CE year $y]
      +    set date [dict create era CE year $y gregorian 1]
           set doy [dict get $z ${bound}DayOfYear]
           if { $doy ne {} } {
       
       	# Time was specified as a day of the year
       
       	if { [dict get $z ${bound}J] ne {}
      -	     && [IsGregorianLeapYear $y]
      +	     && [IsGregorianLeapYear $date]
       	     && ( $doy > $FEB_28 ) } {
       	    incr doy
       	}
      
    2. login: "karl"
    3. mimetype: "text/plain"
  4. Ticket change [22e783dca7] (rid 255931) by kenneth.kienle on 2026-09-03 20:01:57:

    1. icomment:
      Still present in 8.6.18 for any POSIX TZ rule in the `Jn` or `n`
      day-of-year form, as a TZif footer or a `-timezone` string:
      
          % clock format 1720000000 -timezone {EST5EDT,J60,J300}
          time zone "EST5EDT,J60,J300" not found: missing value to go with key
      
      `DeterminePosixDSTTime` passes the bare year to `IsGregorianLeapYear`,
      which expects a date dict and also reads its `gregorian` key. main fixed
      exactly this (the dict is created with `gregorian 1` and passed) - the
      same two lines proposed above in 2016. Attached is the core-8-6-branch
      backport (4 lines). Verified with a synthetic version-2 TZif file whose
      footer is `EST5EDT,J60,J300` and with `IRST-3:30IRDT,J79/24,J263/24`,
      glibc agreeing on every instant; 9.0.4 already passes. No zone in tzdata
      2026c writes a J-form footer (0 of 598), which is why the tests do not
      see it; a user's TZ string does. With the backport this ticket can close.
      Related: [832d098fdfec8f004cf1c8e8836f7c335da12d54].
      
    2. login: "kenneth.kienle"
    3. mimetype: "text/x-markdown"
  5. Add attachment "clock-posix-tz-jday-rule.patch" [ebdc7ae25b] (rid 255932) by kenneth.kienle on 2026-09-03 20:02:33.

  6. Ticket change [30f70a55b9] (rid 256064) by oehhar on 2026-09-04 12:00:36:

    1. icomment:
      Dear Kenneth,
      thanks for the update.
      clock was rewriten by magic Sergey in TCL 9 (due to a bounty by Karl, the original author of the ticket).
      
      The TCL 9 result is:
      
      <verbatim>
      % clock format 1720000000 -timezone {EST5EDT,J60,J300}
      Wed Jul 03 05:46:40 EDT 2024
      </verbatim>
      
      If you can confirm that this result is correct, the bug may be closed.
      Remark, that we don't fix any bugs any more in 8.6, except by backporting on a private initiative basis.
      
      Thanks for all,
      Harald
      
    2. login: "oehhar"
    3. mimetype: "text/x-fossil-wiki"
    4. username: "oehhar"
  7. Ticket change [23fdfadf23] (rid 256118) by kenneth.kienle on 2026-09-07 23:09:10:

    1. icomment:
      Harald,
      
      Confirmed. "Wed Jul 03 05:46:40 EDT 2024" is correct.
      
      I checked it three ways and they agree: Tcl 9.0.5 built from core-9-0-branch,
      glibc (TZ=EST5EDT,J60,J300 date -d @1720000000), and 8.6.18 with the fix Karl
      proposed in his 2016 comment on this ticket.
      
      The reasoning, in case it is useful for the record: J60 is 1 March in every
      year. Jn counts 1 January as day 1 and never counts 29 February, so 2024 being
      a leap year does not move it, and 3 July is well inside DST either way.
      
      So the ticket can be closed as far as I am concerned.
      
      If a backport for 8.6 would be useful, I am happy to prepare one - you mentioned
      that 8.6 takes fixes on a private-initiative basis, and the change is small. No
      need if it is not wanted.
      
      Thank you for the developer access, and for replying so quickly.
      
      Kenneth
      
    2. login: "kenneth.kienle"
    3. mimetype: "text/plain"
  8. Ticket change [d4672b8283] (rid 256137) by kenneth.kienle on 2026-09-08 06:12:45:

    1. icomment:
      Harald,
      
      The backport is on branch bug-aa082a279c-8.6, off core-8-6-branch.
      
      The fix is the one Karl proposed in his 2016 comment on this ticket. Pass $date to IsGregorianLeapYear instead of the bare year, and that is also what trunk does today. The credit is his; I only re-derived and tested it. It came up because I build and test Tcl 8.6 in a custom environment, so the suite runs against system tzdata rather than the bundled copy.
      
      Karl also warned in that comment that setting gregorian to 1 "may malfunction for dates before September of 1752". That is still true, but it is not caused by these two lines. The same skew is already present on the Mm.n.d path in stock, and it comes from the calendar changeover argument passed further down.
      
      One thing worth knowing before taking the branch, making Jn rules work exposes a second, older bug: J59 in a leap year was one day out. FEB_28 is 58, a 0-based day number, but Jn is 1-based, so J59 (28 February) was pushed onto 29 February. Before this backport every Jn rule failed with an error, so nobody could see it. I did not want to make a wrong answer reachable, so the branch corrects that too, in one line, with a test. Trunk has the same bug and nothing here changes trunk.
      
      The branch carries six tests, clock-70.1 to 70.6. Reverting one mechanism at a time, measured:
      
          the leap-year guard alone       fails clock-70.6 and nothing else
          the date dict argument alone    fails all six
      
      The second is expected rather than weak coverage. Passing the dict is what makes any Jn rule evaluate at all, so every test depends on it. None of the six needs system or bundled tzdata, and the expected values were computed with glibc.
      
      Kenneth
      
    2. login: "kenneth.kienle"
    3. mimetype: "text/plain"
  9. Ticket change [52b44c469f] (rid 256139) by oehhar on 2026-09-08 09:13:50:

    1. icomment:
      Great, thanks.
      Sergey (or others), may you double check the branch and merge if ok?
      
      Thanks for all,
      Harald
      
    2. login: "oehhar"
    3. mimetype: "text/x-fossil-wiki"
    4. username: "oehhar"
  10. Ticket change [f468b2e81f] (rid 256192) by sebres on 2026-09-10 22:04:01:

    1. closedate changed to: "2461294.4194628936"
    2. closer changed to: "sebres"
    3. icomment:
      Merged. Thx!
      
      As for J59 and case covered in clock-70.4, yes I am agree - in POSIX Jn rule, leap days are entirely skipped in the count, and because it is day 59 (J59) and exactly 02:00, the switch to DST happens at this very second, so the clock instantly "springs" forward by one hour in this TZ (to avoid DST hole), transforming 02:00 EST (-0500) into 03:00 EDT (-0400).
      
      PoC in *nix shell:
      <code><pre style="margin-left:15pt">
      $ TZ=EST5EDT          date -d @1961564400 '+%Y-%m-%d %H:%M:%S %z %Z'
      2032-02-28 02:00:00 -0500 EST
      $ TZ=EST5EDT,J59,J300 date -d @1961564400 '+%Y-%m-%d %H:%M:%S %z %Z'
      2032-02-28 03:00:00 -0400 EDT
      </pre></code>
      Integrated to 8.6 and 9.0 ([e81697229f3ebad8]).
      
    4. login: "sebres"
    5. mimetype: "text/x-fossil-wiki"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
  11. Ticket change [e5fc73e6ab] (rid 256217) by oehhar on 2026-09-11 13:58:38:

    1. closedate changed to: "2461295.0823931019"
    2. closer changed to: "oehhar"
    3. icomment:
      What about merging to main ?
      
      Thanks for all,
      Harald
      
    4. login: "oehhar"
    5. mimetype: "text/x-fossil-wiki"
    6. username: "oehhar"