| Ticket UUID: | dc69e5ecf04313429fd202b1906cd85bb7888f95 | ||
| Title: | [clock scan] does not recognize AKST or AKDT | ||
| Type: | Bug | Created on: | 2018-05-21 21:06:42 |
| Submitter: | andy | Assigned to: | nobody |
| Subsystem: | 16. Commands A-H | Severity: | Important |
| Priority: | 5 Medium | Last modified: | 2018-05-29 18:06:40 |
| Status: | Open | Closed by: | nobody |
| Resolution: | None | Closed on: | |
| Version: | 8.6.8 | ||
| Description: | ||||
|
[clock format -timezone :America/Anchorage] produces a timezone string of AKDT or AKST, neither of which is supported by [clock scan]. This affects both the legacy freeform and the new parsers. % clock format [clock seconds] -timezone :America/Anchorage Mon May 21 11:53:41 AKDT 2018 % clock scan "Mon May 21 11:53:41 AKDT 2018" unable to convert date-time string "Mon May 21 11:53:55 AKDT 2018": syntax error (characters 19-23) % clock scan "Mon May 21 11:53:55 AKDT 2018" -format "%a %b %d %H:%M:%S %z %Y" time zone "akdt" not found % dict set ::tcl::clock::LegacyTimeZone akdt -0800 % clock scan "Mon May 21 11:53:55 AKDT 2018" -format "%a %b %d %H:%M:%S %z %Y" 1526932435 As shown above, the new parser can be patched by editing $LegacyTimeZone: dict set ::tcl::clock::LegacyTimeZone akdt -0800 dict set ::tcl::clock::LegacyTimeZone akst -0900 The legacy parser can only be fixed by editing tclGetDate.y. Side note: while researching this issue, I noticed several timezones named zp[456] which do not work in the legacy freeform parser due to TclDatelex() not recognizing the trailing digit as part of the token. Not knowing anything about these timezones, I don't feel qualified to file a separate ticket on them. If any work is done in this area, I would also suggest confirming that all timezone strings that can be generated by [clock format] can also be recognized by [clock scan] using both the legacy freeform and new Tcl parsers. | ||||
| User Comments: | ||||
sebres added on 2018-05-23 16:24:00:
Fixed for tclclockmod in tcltk/tclclockmod - 025c25a8bc915a843b708f69bf2857e32f367fb0 Fix for tcl-core will follow shortly. BTW. I don't think that issue with ZP4-ZP6 zones can be easy fixed (because of the probable conflict with number like hour) and it should be fixed at all, because they are user zones... sebres added on 2018-05-25 11:09:50:
By working on the PoC for test-solution over all zones-coverage I found many another missing zones, e. g. for Anchorage:
So the right solution would be to make an aliasing rules (map with legacy TZ -> real TZ), and some simply script that builds this map from library/tzdata/*. As regards the ambiguity regarding ambiguous duplicates: for example it could get a time range to take it into account by searching of the proper real zone. I'll do soon the back-porting of my tclclockmod to the tcl-core and later try to provide a ultimate solution round about legacy zones. sebres added on 2018-05-25 13:24:59:
So currently tried to manipulate tools/tclZIC.tcl to cumulate all shortcut-zones with dst/offset to build a map (excepting etc-zones) from current iana-tzdb, below is the result. As you can see (and as been expecting) several zones have different offsets, therefore I tend to build regular TZ-files for the shortcut zones (similar CET, etc), so within valid time intervals for it.
sebres added on 2018-05-25 19:43:26:
When tinkering round about time-zones abbreviations (which conflict more and more), I've even more questions... @Peter da Silva, @Karl Lehenbauer, @flightaware:
@Chinese Tclers:
For example, I mean the "CST" abbreviation (as provided from iana-tzdb, therefore in TCL also):
So forwards-backwards conversion test like this:
@Everyone:
andy (claiming to be Andy Goth) added on 2018-05-28 22:57:18:
Thank you for your research. It's clear I really ought to amend my code to either write UTC time or a numeric time zone offset. I was simply using the default [clock format] format, but that can be easily changed. Your work is welcome, but if you're hitting ambiguities, it will be problematic no matter what is done. sebres added on 2018-05-29 18:06:40:
I've rebased (back-ported) my tclclockmod back to tcl.core in branch "sebres-8-6-clock-speedup-cr2", where this issue is partially fixed in [deec2700e3] (AKST/AKDT only). Complete fix follows (if I get cleared all lacks of abbreviation, and resolved all conflicts with most popular/usual abbreviations). | ||||
