Skip to content
Tcl Source Code History Of Ticket 3ee8f1c2a785f4d8
Login

History Of Ticket 3ee8f1c2a785f4d8

Artifacts Associated With Ticket 3ee8f1c2a785f4d8

  1. Ticket change [5085853c52] (rid 228658) by sbron on 2024-07-15 09:47:57:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-markdown"
    4. comment initialized to:
      In my code, I frequently use the following method to get the epoch time of the next midnight:
      
      	set midnight [clock scan 24:00:00 -format %T]
      
      In Tcl 9.0 that currently throws an error. Apparently I need to use the option -validate 0 to allow the Tcl 8.6 behavior.
      
      First of all, there is no mention of the -validate option in the clock manual page. [TIP #688](https://core.tcl-lang.org/tips/doc/trunk/tip/688.md) claims that the default value for the -validate option is 0. In practice it seems to actually be 1.
      
      However, the biggest problem is that the produced value is incorrect. Clearly 24:00:00 should be 1 second after 23:59:59. But that is not the case. I wrote the following test script:
      
      	if {[package vsatisfies [package present Tcl] 9]} {
      	    set novalidate {-validate 0}
      	} else {
      	    set novalidate {}
      	}
      
      	set sec1 [clock scan 23:59:59 -format %T {*}$novalidate]
      	set sec2 [clock scan 24:00:00 -format %T {*}$novalidate]
      
      	puts [expr {$sec2 - $sec1}]
      
      In Tcl 8.6 this produces a result of 1, as expected. In Tcl 9.0 it reports -86400 (possibly depending on the day of the week the script is executed).
      
    5. foundin initialized to: "3d8bf31bdc"
    6. is_private initialized to: "0"
    7. login: "sbron"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "8475f421649231f1e116ac602bea4537d2b027b4"
    10. resolution initialized to: "None"
    11. severity initialized to: "Critical"
    12. status initialized to: "Open"
    13. submitter initialized to: "sbron"
    14. subsystem initialized to: "16. Commands A-H"
    15. title initialized to: "Clock scan issues with validation disabled."
    16. type initialized to: "Bug"
  2. Ticket change [940aa28b96] (rid 228659) by oehhar on 2024-07-15 10:39:27:

    1. icomment:
      Thanks for the ticket, great!
      Just an annotation about the default value: TIP 690 changed the default value from 0 to 1:
      [https://core.tcl-lang.org/tips/doc/trunk/tip/690.md]
      
      Take care,
      Harald
      
    2. login: "oehhar"
    3. mimetype: "text/x-fossil-wiki"
    4. username: "oehhar"
  3. Ticket change [eb3b5c1d5f] (rid 228685) by sebres on 2024-07-16 15:37:34:

    1. icomment:
      Although I personally would rather use something like:<br/>
      `clock scan "+1 day"`<br/>
      instead of <br/>
      `clock scan 24:00:00`<br/>
      it is indeed a certain regression (which was not covered previously in the test suite).
      
      I'll add related tests to 8.6+ and fix it ASAP in 8.7+.
      
      By the way, instead of `-validate 0` arguments, one could use `::tcl::unsupported::clock::configure -validate 0` (previously `clock configure -validate 0`) to restore previous behaviour (surely only after the issue with not incremented date gets fixed).
      
    2. login: "sebres"
    3. mimetype: "text/x-markdown"
  4. Ticket change [28d337b9ca] (rid 228698) by sebres on 2024-07-16 18:26:03:

    1. closedate changed to: "2460508.26809517"
    2. closer changed to: "sebres"
    3. foundin changed to: "8.7+ (new clock engine)"
    4. icomment:
      Fixed in [70997824b1e313a7] (8.7) and [d15ae7fe510f3a7d] (9.0)...
      
      Although, how one could see, it introduces now a small deviation to previous handling, this time in freescan (without -format argument), see test clock-46.6 - it doesn't return -1 anymore for invalid time (without validation) and behaves like "normal" scan now. It happens because of code deduplication in new clock engine - both scans convert the input time using ToSeconds function, which was modified now to fix this issue. And because freescan is legacy (deprecated) thing, I have no intention to hold it compatible to 8.6, moreover I'd like to keep both (scan and freescan) consistent to each other, so freescan behaves now more similar to scan (with format).
      
    5. login: "sebres"
    6. mimetype: "text/x-fossil-wiki"
    7. resolution changed to: "Fixed"
    8. severity changed to: "Severe"
    9. status changed to: "Closed"