| Ticket UUID: | c6f1ffa7a96b949c58b5bae73d6184c6ccbf4b0e | ||
| Title: | clock scan/freescan deviation (wrong conversion) if TZ specified in the input | ||
| Type: | Bug | Created on: | 2019-04-29 20:00:14 |
| Submitter: | sebres | Assigned to: | nobody |
| Subsystem: | 16. Commands A-H | Severity: | Severe |
| Priority: | 5 Medium | Last modified: | 2019-05-09 17:57:43 |
| Status: | Open | Closed by: | nobody |
| Resolution: | None | Closed on: | |
| Version: | all | ||
| Description: | ||||
|
Clock scan/freescan show several deviations resp. wrong conversion if time zone is specified in the input. | ||||
| User Comments: | ||||
sebres added on 2019-05-01 16:05:15:
Following snippet illustrates the ambiguity problem: The time-point of the applying of time zone if only time is provided for scan of if some info is missing and will be retrieved from base. Rather it looks like a precedence question - which time zone should win:
Variant 1:
% _test 1556240400 {10:00 GMT} -format {%H:%M %Z}
== :GMT ==
base: Fri Apr 26 01:00:00 GMT 2019 = Fri Apr 26 01:00:00 GMT 2019
scan: Fri Apr 26 10:00:00 GMT 2019 = Fri Apr 26 10:00:00 GMT 2019
== :America/New_York ==
base: Thu Apr 25 21:00:00 EDT 2019 = Fri Apr 26 01:00:00 GMT 2019
scan: Thu Apr 25 06:00:00 EDT 2019 = Thu Apr 25 10:00:00 GMT 2019
Variant 2:
% _test 1556240400 {10:00 GMT} -format {%H:%M %Z}
== :GMT ==
base: Fri Apr 26 01:00:00 GMT 2019 = Fri Apr 26 01:00:00 GMT 2019
scan: Fri Apr 26 10:00:00 GMT 2019 = Fri Apr 26 10:00:00 GMT 2019
== :America/New_York ==
base: Thu Apr 25 21:00:00 EDT 2019 = Fri Apr 26 01:00:00 GMT 2019
scan: Fri Apr 26 06:00:00 EDT 2019 = Fri Apr 26 10:00:00 GMT 2019
My tclclockmod (and clock-speedup branch) uses Variant 1 at the moment: And current (broken) state of tcl-core (in all versions):
-% _test 1556240400 {10:00 GMT} -format {%H:%M %Z}; # format scan
+% _test 1556240400 {10:00 GMT} ; # free scan
== :GMT ==
base: Fri Apr 26 01:00:00 GMT 2019 = Fri Apr 26 01:00:00 GMT 2019
scan: Fri Apr 26 10:00:00 GMT 2019 = Fri Apr 26 10:00:00 GMT 2019
== :America/New_York ==
base: Thu Apr 25 21:00:00 EDT 2019 = Fri Apr 26 01:00:00 GMT 2019
-scan: Fri Apr 26 06:00:00 EDT 2019 = Fri Apr 26 10:00:00 GMT 2019
+scan: Thu Apr 25 06:00:00 EDT 2019 = Thu Apr 25 10:00:00 GMT 2019
sebres added on 2019-05-02 19:18:26:
More tests showing additionally another basic difference between both scan proceedings - fixed-format scan is following the general rule "if the string contains neither a %s format group nor a group specifying the hour of the day, then midnight (00:00, the start of the given date) is used." as it is documented, where free scan is always preferring a current time in this case. Here is a short script illustrating this difference related to the time zone issue (so free scan is also wrong here if another TZ used in the input):
Original (unpatched tcl-clock):
The fix changes the behavior, considering the higher precedence of TZ in input, as well as the general rule (no time == 00:00) of the fixed-format scan and free scan (no time == time of now):
sebres added on 2019-05-09 17:57:43:
And possibly still one case:
| ||||
