Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 4d954a2262d240e78e45fb14c1e3f1c8353436b1a50e164133f7ab6051a787fd
Ticket: f2b5f89c0d8520ea86b929daa19ec13fc3a24d2d
clock scan of leapsecond: wrong result in 8.6 and 9.0
User & Date: sebres on 2024-11-15 01:16:24
Changes

  1. icomment:
    No matter how (`-valid 0` or `[string map {23:59:60 23:59:59}]`) or other pre-processors, the result may be wrong or not (but it is and remains users decision)...<br/>
    For instance, because the thing you want to implement is simply not supported in unix time at all. It is quasi like an undefined behavior - basically you don't know whether `2016-12-31 23:59:60` is 1483228800 or 1483228799, because it simply doesn't exist in sense of unix time (or nobody knowns which second since epoch it really mean - the first or the next). Maybe it is not important, but perhaps it is, therefore - UB.
    
    With other words, it is like DST hole, for instance the dates `"2024-03-31 02:00:00 CET"` or `"2024-03-31 02:59:59 CEST"` simply don't exist in that timezone, because after `"01:59:59"` follows `"03:00:00"`:
    
    <code><pre style="padding-left:20pt">
    % clock format 1711846799 -format "%Y-%m-%d %H:%M:%S" -timezone :Europe/Berlin
    2024-03-31 01:59:59
    % clock format 1711846800 -format "%Y-%m-%d %H:%M:%S" -timezone :Europe/Berlin
    2024-03-31 03:00:00<br/>
    % clock scan "2024-03-31 02:00:00" -format "%Y-%m-%d %H:%M:%S" -timezone :Europe/Berlin
    <b style="color:red;">unable to convert input string: invalid time (does not exist in this time-zone)</b>
    % clock scan "2024-03-31 02:59:59" -format "%Y-%m-%d %H:%M:%S" -timezone :Europe/Berlin
    <b style="color:red;">unable to convert input string: invalid time (does not exist in this time-zone)</b>
    </pre></code>
    
    And you seem to implement similar thing for the leap second, which also doesn't exist in sense of clock and POSIX time.
    I know that leap second cannot be compared with DST, but similar is here that this is a non-existing thing, so to say a phantom, and it shall remain so (at least with default clock facilities). And by the way, it is also affected by `-validate` parameter, because both of above mentioned scans will work with `-valid 0` (and generate 1 hour deviation by formatting back) and therefore also here have a certain similarity, in sense of wrong unix time.
    
    Anyway I see this definitively as an enhancement and not as bug fix. But if it is improvement, then properly (with real UT-time values, without a phantom behavior, with correct leap tables etc).
    
  2. login: "sebres"
  3. mimetype: "text/x-markdown"