Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 7bc36478880cf174d8e986c8eabacc4f613092cdf28e5acbc7e5304ed48a96d9
Ticket: f2b5f89c0d8520ea86b929daa19ec13fc3a24d2d
clock scan of leapsecond: wrong result in 8.6 and 9.0
User & Date: jan.nijtmans on 2024-11-22 13:48:14
Changes

  1. icomment:
    > And I don't stop to ask you, why you are in mode to continue to prefer a false result to no result (or even to right result, like in my branch)?
    
    There is no 'right' answer here. Returning 1341100799 is as wrong as 1341100800. What UNIX does is smearing out, so we could map 23:59:59 to 1341100799, 23:59:60 to 1341100799.5 and 00:00:00 (next day) to 1341100800. But we currently don't support fractions, so we have to round down (your propsal) or up (my proposal, and current Tcl 8.x behavior). Returning a different timestamp for -valid 1 and -valid 0 is not logical: -valid should only influence the validation, nothing else.
    
    The challenge is providing a consistent behavior. I'm doing that by assuming a second value of "60" to be valid unless the time string contains something which disallows this. Such as a date which is not jan 1, june 30, july 1 or dec 31. Or when the (minute % 15) != 14. Or (recently) when the year is < 1972 or > 2017.
    
    <pre>
    % clock scan "23:59:59"
    1732316399
    % clock scan "23:59:60"
    1732316400
    % clock scan "00:00:00 tomorrow"
    1732316400
    </pre>
    
    This makes 100% sense to me, even though I know today we don't have a leap-second.
    
  2. login: "jan.nijtmans"
  3. mimetype: "text/x-fossil-wiki"