Overview
| Artifact ID: | 5085853c52429b482e648bd2a8d4ed9d6958c3714958cd7e4d264fc2a413973d |
|---|---|
| Ticket: | 3ee8f1c2a785f4d8bd0ca60f1076cee78ebb3255
Clock scan issues with validation disabled. |
| User & Date: | sbron on 2024-07-15 09:47:57 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-markdown"
- comment changed 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). - foundin changed to: "3d8bf31bdc"
- is_private changed to: "0"
- login: "sbron"
- priority changed to: "5 Medium"
- private_contact changed to: "8475f421649231f1e116ac602bea4537d2b027b4"
- resolution changed to: "None"
- severity changed to: "Critical"
- status changed to: "Open"
- submitter changed to: "sbron"
- subsystem changed to: "16. Commands A-H"
- title changed to: "Clock scan issues with validation disabled."
- type changed to: "Bug"