diff options
author | Kevin B Kenny <kennykb@acm.org> | 2009-10-27 03:23:32 (GMT) |
---|---|---|
committer | Kevin B Kenny <kennykb@acm.org> | 2009-10-27 03:23:32 (GMT) |
commit | 42f969aa26927fe8d84250dbc72ce1dc9e7f8836 (patch) | |
tree | 14e60f6e093b66a12c85ca2f25b09a2bf38462ae /library/clock.tcl | |
parent | a105e211c00630f0a0cbee1031379b3f187c3b9c (diff) | |
download | tcl-42f969aa26927fe8d84250dbc72ce1dc9e7f8836.zip tcl-42f969aa26927fe8d84250dbc72ce1dc9e7f8836.tar.gz tcl-42f969aa26927fe8d84250dbc72ce1dc9e7f8836.tar.bz2 |
* library/clock.tcl (ParseClockScanFormat):
Corrected a problem where [clock scan] didn't load the timezone
soon enough when processing a time format that lacked a complete
date. [Bug 2886852]
* tests/clock.test (clock-66.1):
Added a test case for the above bug.
Diffstat (limited to 'library/clock.tcl')
-rw-r--r-- | library/clock.tcl | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/library/clock.tcl b/library/clock.tcl index bc4ec4d..51118e1 100644 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -13,7 +13,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: clock.tcl,v 1.55 2009/10/24 22:20:10 kennykb Exp $ +# RCS: @(#) $Id: clock.tcl,v 1.56 2009/10/27 03:23:32 kennykb Exp $ # #---------------------------------------------------------------------- @@ -1955,6 +1955,21 @@ proc ::tcl::clock::ParseClockScanFormat {formatString locale} { append procBody $postcode append procBody [list set changeover [mc GREGORIAN_CHANGE_DATE]] \n + # Set up the time zone before doing anything with a default base date + # that might need a timezone to interpret it. + + if { ![dict exists $fieldSet seconds] + && ![dict exists $fieldSet starDate] } { + if { [dict exists $fieldSet tzName] } { + append procBody { + set timeZone [dict get $date tzName] + } + } + append procBody { + ::tcl::clock::SetupTimeZone $timeZone + } + } + # Add code that gets Julian Day Number from the fields. append procBody [MakeParseCodeFromFields $fieldSet $DateParseActions] @@ -1963,7 +1978,9 @@ proc ::tcl::clock::ParseClockScanFormat {formatString locale} { append procBody [MakeParseCodeFromFields $fieldSet $TimeParseActions] - # Assemble seconds, and convert local nominal time to UTC. + # Assemble seconds from the Julian day and second of the day. + # Convert to local time unless epoch seconds or stardate are + # being processed - they're always absolute if { ![dict exists $fieldSet seconds] && ![dict exists $fieldSet starDate] } { @@ -1978,17 +1995,10 @@ proc ::tcl::clock::ParseClockScanFormat {formatString locale} { + [dict get $date secondOfDay] }] } - } - if { ![dict exists $fieldSet seconds] - && ![dict exists $fieldSet starDate] } { - if { [dict exists $fieldSet tzName] } { - append procBody { - set timeZone [dict get $date tzName] - } - } + # Finally, convert the date to local time + append procBody { - ::tcl::clock::SetupTimeZone $timeZone set date [::tcl::clock::ConvertLocalToUTC $date[set date {}] \ $TZData($timeZone) $changeover] } |