Ticket UUID: | 3ee8f1c2a785f4d8bd0ca60f1076cee78ebb3255 | |||
Title: | Clock scan issues with validation disabled. | |||
Type: | Bug | Version: | 8.7+ (new clock engine) | |
Submitter: | sbron | Created on: | 2024-07-15 09:47:57 | |
Subsystem: | 16. Commands A-H | Assigned To: | nobody | |
Priority: | 5 Medium | Severity: | Severe | |
Status: | Closed | Last Modified: | 2024-07-16 18:26:03 | |
Resolution: | Fixed | Closed By: | sebres | |
Closed on: | 2024-07-16 18:26:03 | |||
Description: |
In my code, I frequently use the following method to get the epoch time of the next midnight:
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 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:
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). | |||
User Comments: |
sebres added on 2024-07-16 18:26:03:
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). sebres added on 2024-07-16 15:37:34: Although I personally would rather use something like: I'll add related tests to 8.6+ and fix it ASAP in 8.7+. By the way, instead of oehhar added on 2024-07-15 10:39:27: 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 |
