Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 5945124dac6379a629e1b5d236528b477bc32b9b00de451b3af568f287f843ae
Ticket: f2b5f89c0d8520ea86b929daa19ec13fc3a24d2d
clock scan of leapsecond: wrong result in 8.6 and 9.0
User & Date: sebres on 2024-11-14 19:22:32
Changes

  1. icomment:
    Nope, the fix in that way will be incorrect:
    
    1. leap seconds are affecting both, the POSIX time and its string representation (textual form) equally, the fix (in this way) would only affect the latter and incorrectly correlate with the former, what simply makes the timestamps `2016-12-31 23:59:60` and `2017-01-01 00:00:00` completely equivalent, what in turn has nothing to do with the leap second. It looks to me like (faulty) analogy between leap hour and DST, what mathematically seen is definitely wrong. Moreover by a scan you'd never get time `23:59:60` back, so it'd introduce additional inconsistency:
      ```
      % clock scan "2016-12-31 23:59:60" -gmt 1 -valid 0
      1483228800
      % clock scan "2017-01-01 00:00:00" -gmt 1
      1483228800
      % clock format [clock scan "2016-12-31 23:59:60" -gmt 1 -valid 0] -gmt 1 -format "%Y-%m-%d %T"
      2017-01-01 00:00:00
      ```
    2. therefore a correct implementation shall definitely consider leap seacond like a leap year, however in opposite to it, to compute the textual representation or elapsed time in seconds between two given UTC dates, it'd require the consultation of a table of leap seconds (it is not nearly mathematical like the leap years);
    3. many clocks implement leap seconds in different manner: some ignore them completely (e. g. accept possible time drift by time adjustment), some use different adjustments procedures, e. g. leap seconds in Unix time are commonly implemented by repeating 23:59:59 (rarely by adding the time-stamp 23:59:60), SNTP simply freezes time during the leap second;
    4. the textual representation of a leap second is defined by BIPM as "23:59:60", moreover leap second is always scheduled for UTC midnight at the end of the last day of a month (Jun or Dec), so even if we'd decide to ignore leap second but allows to accept such times in textual form, it shall be considered by validity rules of "...:60" times (allowed only there, ideally checking aforementioned table of leap seconds).
    
    Accordingly, your example for 8.7 is not correct too... basically the subject of leap seconds was always "ignored" in tcls clock. The validity feature (introduced in 8.7 and made default on in 9.0) just brought the thing to light.
    
  2. login: "sebres"
  3. mimetype: "text/x-markdown"