Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: e16b55ce422ac0026aca19b77c6942bc70ad21ebee47c4c1b68de4dbfba83fd3
Ticket: f2b5f89c0d8520ea86b929daa19ec13fc3a24d2d
clock scan of leapsecond: wrong result in 8.6 and 9.0
User & Date: sebres on 2024-11-22 15:18:44
Changes

  1. icomment:
    > There is no 'right' answer here.<br/>
    > So we have to round down (your propsal) or up (my proposal, and current Tcl 8.x behavior)...
    
    And what is about:
    
    - all current OS round it down (freezes the second);
    - the ISO standard definitely says about the same calendar day;
    - it is more logical and consistent to behave the same year/month/quarter/week/date/hour/minute, because it simply corresponds to input string more sane;
    - it'd be more consistent if some formatted tokens will be supplied to other processes or further calculations (since it is still the same day and the OS second "T235960 UTC" is equal "T235959 UTC").
    - Tcl 8.x behavior is not even few days old (previously it was wrong completely, at least in free-scan unless I repaired it);
    
    To me the "right" answer is pretty clear (or there are basically two answers: round down or forbid it).
    
    > Returning a different timestamp for -valid 1 and -valid 0 is not logical: -valid should only influence the validation, nothing else. 
    
    Who said it will?<br/>
    My branch does it ALWAYS, regardless the -validate parameter... Correct leap second will be the same as "T235959 UTC", in any case. Only wrong leap second moves to next day (with -valid 0) as previously:
    
    ```
    % clock scan "2012-06-30 23:59:60 UTC"
    1341100799
    % clock scan "2012-06-30 23:59:60 UTC" -valid 1
    1341100799
    
    % clock scan "2012-06-29 23:59:60 UTC"
    1341014400
    % clock scan "2012-06-29 23:59:60 UTC" -valid 1
    unable to convert input string: invalid time
    ```
    
    See also the new tests in the branch that doesn't have constraints to valid_off (so works for both in the same manner).
    
    > The challenge is providing a consistent behavior.
    
    I already mastered this challenge.<br/>
    However I'm still unsure whether the leap second need to be considered as valid (and my branch need to be merged). But I'm definitely against your solution, that you merged to 8.7/9.0 despite all objections from my side.
    
    > This makes 100% sense to me
    
    It does not at all (the both former are today, the latter is tomorrow).<br/>
    And then you seemed not to read, what I wrote all the time before.
    
    For example, what do you think would happen, if some large bank transaction (occurred exactly on the leap second) moves to the next day which would be at least next quarter or even 1 Jan of next year, for instance? Right, it can be booked in wrong week, quarter or even year, what could have hard consequences for the company or even for the state, cause new debts or decreasing the rank score. Let alone every bank has reporting obligations, for instance to ECB, and ECB also has such reporting obligations, which can be wrong. Therefore I emphasize it again, I'll always prefer no result (BOOM) to the wrong result.
    But also "rounding" down looks to me fewer wrong than "rounding" up (jump to next calendar day), at least it is more consistent in any directions (see begin of my comment).
    
  2. login: "sebres"
  3. mimetype: "text/x-markdown"