Artifacts Associated With Ticket 3475995fffffffffffffffffffffffffffffffff
Ticket change [52d5f53904] (rid 126388) by sebres on 2012-01-19 10:58:42:
- assignee initialized to: "dkf"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Behavior: After introducing tcl8.5 the scan does not fails on logical invalid dates like 02/30/2008 and build another date as specified : % clock format [clock scan "2008-02-30"] Sat Mar 01 00:00:00 CET 2008 % clock format [clock scan "24:62:80"] -format {%T} 23:59:59 Solution: see attached patch - patched execute : % clock format [clock scan "2008-02-30"] unable to convert date-time string "2008-02-30": invalid day while executing "clock scan "2008-02-30"" % clock format [clock scan "24:62:80"] -format {%T} unable to convert date-time string "24:62:80": invalid time while executing "clock scan "24:62:80"" To call "clock scan" without validating use this one (backwards compatible to 8.5.11): % clock format [clock scan "2008-02-30" -valid 0] Sat Mar 01 00:00:00 CET 2008 % clock format [clock scan "24:62:80" -valid 0] -format {%T} 23:59:59 The patch contains more as only this fix - example ::tcl::clock::MakeDate - to create a seconds/date dict directly (but here without date validating - see below), for example to create date from SQL-engine structures : % puts [set date [::tcl::clock::MakeDate year 2008 month 2 dayOfMonth 20 hour 0 minute 0 second 0 tzName {}]] year 2008 month 2 dayOfMonth 20 hour 0 minute 0 second 0 tzName {} era CE julianDay 2454517 secondOfDay 0 localSeconds 1203465600 seconds 1203462000 % puts "[dict get $date seconds] - [clock format [dict get $date seconds]]" 1203462000 - Wed Feb 20 00:00:00 CET 2008 To validate given date structure - use ::tcl::clock::ValidDate : % puts [set date [::tcl::clock::MakeDate year 2008 month 2 dayOfMonth 20 hour 0 minute 0 second 0 tzName {}]] year 2008 month 2 dayOfMonth 20 hour 0 minute 0 second 0 tzName {} era CE julianDay 2454517 secondOfDay 0 localSeconds 1203465600 seconds 1203462000 % ::tcl::clock::ValidDate $date {} % puts [set date [::tcl::clock::MakeDate year 2008 month 2 dayOfMonth 32 hour 0 minute 0 second 0 tzName {}]] year 2008 month 2 dayOfMonth 32 hour 0 minute 0 second 0 tzName {} era CE julianDay 2454529 secondOfDay 0 localSeconds 1204502400 seconds 1204498800 % ::tcl::clock::ValidDate $date {} unable to convert date-time string "": invalid day while executing "::tcl::clock::ValidDate $date {}" - foundin initialized to: "obsolete: 8.5.11"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "sebres"
- subsystem initialized to: "16. Commands A-H"
- title initialized to:
[solved] clock scan success by logical invalid date/time
- type initialized to: "Bug"
Add attachment "clock.tcl.patch" [7891deaa46] (rid 89980) by sebres on 2012-01-19 17:58:42.
Ticket change [59d88bd026] (rid 118034) by sebres on 2012-01-19 17:58:42:
- icomment:
File Added - 433455: clock.tcl.patch
- login: "sebres"
- mimetype: "text/plain"
- username: "sebres"
- icomment:
Ticket change [2774b06caa] (rid 88521) by sebres on 2012-01-19 17:59:06:
- priority changed to: "3 Low"
Ticket change [1016af8d63] (rid 94909) by dkf on 2012-01-21 20:14:35:
- assignee changed to: "kennykb"
- subsystem changed to: "06. Time Measurement"
Ticket change [5e0db30e9d] (rid 115573) by sebres on 2012-02-02 16:24:43:
- icomment:
In addition, i have made performance patch for clock.tcl (attached) ... with up to double performance increase. Please do not forget that command "scan", compared to the standard version, also validate the date and time (i.e. additional time needed for Valid file), but nevertheless still faster in patched version. To disable this (work as original tcl) use "-valid 0" arguments. % set s [clock seconds]; puts [time {clock format $s} 50000] 38.76 microseconds per iteration % set s [clock seconds]; puts [time {clock format $s -locale de} 50000] 40.3 microseconds per iteration % set s [clock seconds]; puts [time {clock format $s -format %A%B/%d/%Y -locale en} 50000] 28.44 microseconds per iteration % set s [clock seconds]; puts [time {clock format $s -format %A%B/%d/%Y -locale de} 50000] 29.06 microseconds per iteration % set s [clock seconds]; puts [time {clock format $s -format %A%B/%d/%Y -locale fr} 50000] 29.06 microseconds per iteration % % puts [time {clock scan "10/10/2011"} 50000] 40.62 microseconds per iteration % puts [time {clock scan "10/10/2011" -format %m/%d/%Y} 50000] 94.36 microseconds per iteration % puts [time {clock scan "10/10/2011" -format %m/%d/%Y -locale de} 50000] 96.56 microseconds per iteration % puts [time {clock scan "WednesdayJuly/29/1987" -format %A%B/%d/%Y -locale en} 50000] 159.7 microseconds per iteration % puts [time {clock scan "MittwochJuli/29/1987" -format %A%B/%d/%Y -locale de} 50000] 216.88 microseconds per iteration % puts [time {clock scan "mercredijuillet/29/1987" -format %A%B/%d/%Y -locale fr} 50000] 182.5 microseconds per iteration % % source {other/clock.tcl} % tcl::clock::ClearCaches % % set s [clock seconds]; puts [time {clock format $s} 50000] 22.5 microseconds per iteration % set s [clock seconds]; puts [time {clock format $s -locale de} 50000] 22.18 microseconds per iteration % set s [clock seconds]; puts [time {clock format $s -format %A%B/%d/%Y -locale en} 50000] 18.44 microseconds per iteration % set s [clock seconds]; puts [time {clock format $s -format %A%B/%d/%Y -locale de} 50000] 18.74 microseconds per iteration % set s [clock seconds]; puts [time {clock format $s -format %A%B/%d/%Y -locale fr} 50000] 18.44 microseconds per iteration % % puts [time {clock scan "10/10/2011"} 50000] 36.56 microseconds per iteration % puts [time {clock scan "10/10/2011" -format %m/%d/%Y} 50000] 60.62 microseconds per iteration % puts [time {clock scan "10/10/2011" -format %m/%d/%Y -locale de} 50000] 62.5 microseconds per iteration % puts [time {clock scan "WednesdayJuly/29/1987" -format %A%B/%d/%Y -locale en} 50000] 143.1 microseconds per iteration % puts [time {clock scan "MittwochJuli/29/1987" -format %A%B/%d/%Y -locale de} 50000] 176.24 microseconds per iteration % puts [time {clock scan "mercredijuillet/29/1987" -format %A%B/%d/%Y -locale fr} 50000] 147.8 microseconds per iteration - login: "sebres"
- mimetype: "text/plain"
- priority changed to: "4"
- username: "sebres"
- icomment:
Ticket change [b943071786] (rid 129109) by sebres on 2012-02-02 16:24:44:
- title changed to:
[solved/opt] clock scan success by logical invalid date/time
- title changed to:
Add attachment "clock.tcl.patch" [29b8ec6aab] (rid 88917) by sebres on 2012-02-02 16:25:38.
Ticket change [eaf6624fb7] (rid 103456) by sebres on 2012-02-02 16:25:38:
- icomment:
File Added - 434678: clock.tcl.patch
- login: "sebres"
- mimetype: "text/plain"
- username: "sebres"
- icomment:
Ticket change [1361101951] (rid 124208) by sebres on 2012-02-02 16:26:14:
- icomment:
File Added - 434679: clock.tcl
- login: "sebres"
- mimetype: "text/plain"
- username: "sebres"
- icomment:
Add attachment "clock.tcl" [8ca7a5e2c8] (rid 127776) by sebres on 2012-02-02 16:26:14.
Ticket change [b4630b63d0] (rid 125026) by sebres on 2012-02-15 00:09:53:
- icomment:
I have commited new version into http://core.tcl.tk/tcl/info/aa30a04b13 currently not safe for current development core-8-5-branch (see Artifact 3487626) safe for original tcl8.5
- login: "sebres"
- mimetype: "text/plain"
- username: "sebres"
- icomment:
Ticket change [ac89e39c99] (rid 101314) by sebres on 2012-02-15 17:47:28:
- icomment:
Dkf has fixed it in core-8-5-branch. Thanks. So it's now safe within core-8-5-branch.
- login: "sebres"
- mimetype: "text/plain"
- username: "sebres"
- icomment:
Ticket change [d9e89b442f] (rid 159905) by sebres on 2017-12-28 17:52:24:
- assignee changed to: "aku"
- closer changed to: "nobody"
- comment changed to:
Behavior: After introducing tcl8.5 the scan does not fails on logical invalid dates like 02/30/2008 and build another date as specified : % clock format [clock scan "2008-02-30"] Sat Mar 01 00:00:00 CET 2008 % clock format [clock scan "24:62:80"] -format {%T} 23:59:59 Solution: see attached patch - patched execute : % clock format [clock scan "2008-02-30"] unable to convert date-time string "2008-02-30": invalid day while executing "clock scan "2008-02-30"" % clock format [clock scan "24:62:80"] -format {%T} unable to convert date-time string "24:62:80": invalid time while executing "clock scan "24:62:80"" To call "clock scan" without validating use this one (backwards compatible to 8.5.11): % clock format [clock scan "2008-02-30" -valid 0] Sat Mar 01 00:00:00 CET 2008 % clock format [clock scan "24:62:80" -valid 0] -format {%T} 23:59:59 The patch contains more as only this fix - example ::tcl::clock::MakeDate - to create a seconds/date dict directly (but here without date validating - see below), for example to create date from SQL-engine structures : % puts [set date [::tcl::clock::MakeDate year 2008 month 2 dayOfMonth 20 hour 0 minute 0 second 0 tzName {}]] year 2008 month 2 dayOfMonth 20 hour 0 minute 0 second 0 tzName {} era CE julianDay 2454517 secondOfDay 0 localSeconds 1203465600 seconds 1203462000 % puts "[dict get $date seconds] - [clock format [dict get $date seconds]]" 1203462000 - Wed Feb 20 00:00:00 CET 2008 To validate given date structure - use ::tcl::clock::ValidDate : % puts [set date [::tcl::clock::MakeDate year 2008 month 2 dayOfMonth 20 hour 0 minute 0 second 0 tzName {}]] year 2008 month 2 dayOfMonth 20 hour 0 minute 0 second 0 tzName {} era CE julianDay 2454517 secondOfDay 0 localSeconds 1203465600 seconds 1203462000 % ::tcl::clock::ValidDate $date {} % puts [set date [::tcl::clock::MakeDate year 2008 month 2 dayOfMonth 32 hour 0 minute 0 second 0 tzName {}]] year 2008 month 2 dayOfMonth 32 hour 0 minute 0 second 0 tzName {} era CE julianDay 2454529 secondOfDay 0 localSeconds 1204502400 seconds 1204498800 % ::tcl::clock::ValidDate $date {} unable to convert date-time string "": invalid day while executing "::tcl::clock::ValidDate $date {}" - icomment:
Re-implemented in C for new clock-engine (tclclockmod), see <a href="https://github.com/sebres/tclclockmod/pull/10">github/sebres/tclclockmod#10</a>.
- login: "sebres"
- mimetype: "text/x-fossil-wiki"
- severity changed to: "Minor"
Ticket change [3b4281ba9d] (rid 259728) by serhiy.storchaka on 2026-10-21 10:03:38:
- icomment:
Implemented in 9.0.0: TIP 688 ([dd916eacf3]) added <tt>clock scan -validate</tt>, and TIP 690 ([f330be6e51]) made validation the default, so <tt>2008-02-30</tt> and <tt>24:62:80</tt> are rejected. <tt>-valid 0</tt> gives the old behaviour. 8.6 is unchanged.
- login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- icomment:
Ticket change [aae2c0a9d5] (rid 260020) by serhiy.storchaka on 2026-10-22 17:19:31:
- closedate changed to: "2461334.919191296"
- closer changed to: "serhiy.storchaka"
- login: "serhiy.storchaka"