time zones unrecognized [?]
Closed / Invalid1832808fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 19 years ago
Descriptionplain2007-11-15 23:00:54
According to http://www.tcl.tk/man/tcl8.5/TclCmd/clock.htm I should be able to specify a time zone to [clock scan]. This appears to work is it is specified numerically (like "-800") but does not appear to recognize the advertised time zone names IF supplied as an option to [clock]. It does appear to work when supplied in the time string itself. (Tcl) 1 % puts $tcl_patchLevel 8.5b1 (Tcl) 2 % clock scan "17:53" -timezone -800 1195177980 (Tcl) 3 % clock scan "17:53" -timezone PST time zone PST not found (Tcl) 4 % clock scan "17:53" -timezone pst time zone pst not found However: (Tcl) 5 % clock scan "17:53 pst" 1195177980 All this is on a (Tcl) 6 % puts $tcl_platform(os) Windows NT (Tcl) 7 % puts $tcl_platform(osVersion) 5.1
kennykbplain2008-02-27 09:05:57
Logged In: YES
user_id=99768
Originator: NO
The legacy time zone names like 'pst' are intentionally not accepted in the -timezone argument, but only in the date/time strings presented to the parser. They are rejected because they are ambiguous; is "BST" "Brazilian Standard Time" or "British Summer Time?". They are also generally not what is desired for -timezone, because they are unaware of Daylight Saving Time and similar changes. (They must be accepted in input date/time strings, for compatibility with versions of Tcl prior to 8.5).
To get the effect that you're after, use:
clock scan "17:53" -timezone :America/Los_Angeles
(US)
or
clock scan "17:53" -timezone :America/Vancouver
clock scan "17:53" -timezone :America/Whitehorse
clock scan "17:53" -timezone :America/Dawson
(Canada)
or
clock scan "17:53" -timezone :America/Tijuana
clock scan "17:53" -timezone :America/Mazatlan
clock scan "17:53" -timezone :America/Hermosillo
(Mexico)
and you'll get the correct locale-dependent Daylight Saving Time rules.
Log in (anonymous is fine) to add a comment.