diff options
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | library/clock.tcl | 6 | ||||
-rw-r--r-- | tests/clock.test | 44 |
3 files changed, 58 insertions, 3 deletions
@@ -1,3 +1,14 @@ +2004-10-26 Kevin B. Kenny <kennykb@acm.org> + + * library/clock.tcl (FreeScan): Fixed a bug that caused relative + days of the week in free-form [clock scan] to be evaluated in the + wrong time zone. + * tests/clock.test (clock-31.[456]): Made sure that there + isn't an env(TZ) or env(TCL_TZ) lying around that will + override the time zone that we're trying to establish with + the simulated registry. + Both problems reported as [Bug 1054101]. + 2004-10-25 Donal K. Fellows <donal.k.fellows@man.ac.uk> * doc/string.n (map): Rewrote to clarify that we don't just map diff --git a/library/clock.tcl b/library/clock.tcl index 15456d2..0f91cca 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.9 2004/10/25 17:24:39 dgp Exp $ +# RCS: @(#) $Id: clock.tcl,v 1.10 2004/10/26 02:08:38 kennykb Exp $ # #---------------------------------------------------------------------- @@ -1280,9 +1280,11 @@ proc ::tcl::clock::FreeScan { string base timezone locale } { [expr { -210866803200 + ( 86400 * wide([dict get $date julianDay]) ) + [dict get $date secondOfDay] }] + dict set date tzName $timezone set date [ConvertLocalToUTC $date[set date {}]] set seconds [dict get $date seconds] + # Do relative times if { [llength $parseRel] > 0 } { @@ -1320,7 +1322,7 @@ proc ::tcl::clock::FreeScan { string base timezone locale } { [expr { -210866803200 + ( 86400 * wide([dict get $date2 julianDay]) ) + [dict get $date secondOfDay] }] - dict set date2 tzname $timezone + dict set date2 tzName $timezone set date2 [ConvertLocalToUTC $date2[set date2 {}]] set seconds [dict get $date2 seconds] diff --git a/tests/clock.test b/tests/clock.test index f0752bc..79f1970 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -11,7 +11,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.test,v 1.47 2004/10/22 14:27:39 kennykb Exp $ +# RCS: @(#) $Id: clock.test,v 1.48 2004/10/26 02:08:39 kennykb Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -34733,6 +34733,14 @@ test clock-31.4 {system locale} \ namespace eval ::tcl::clock { namespace import -force ::testClock::registry } + if { [info exists env(TZ)] } { + set oldTZ $env(TZ) + unset env(TZ) + } + if { [info exists env(TCL_TZ)] } { + set oldTclTZ $env(TCL_TZ) + unset env(TCL_TZ) + } ::tcl::clock::ClearCaches } \ -body { @@ -34742,6 +34750,12 @@ test clock-31.4 {system locale} \ namespace eval ::tcl::clock { rename registry {} } + if { [info exists oldTclTZ] } { + set env(TCL_TZ) $oldTclTZ + } + if { [info exists oldTZ] } { + set env(TZ) $oldTZ + } ::tcl::clock::ClearCaches } \ -result [clock format 0 -locale current -timezone EST5 \ @@ -34753,6 +34767,14 @@ test clock-31.5 {system locale} \ namespace eval ::tcl::clock { namespace import -force ::testClock::registry } + if { [info exists env(TZ)] } { + set oldTZ $env(TZ) + unset env(TZ) + } + if { [info exists env(TCL_TZ)] } { + set oldTclTZ $env(TCL_TZ) + unset env(TCL_TZ) + } ::tcl::clock::ClearCaches } \ -body { @@ -34762,6 +34784,12 @@ test clock-31.5 {system locale} \ namespace eval ::tcl::clock { rename registry {} } + if { [info exists oldTclTZ] } { + set env(TCL_TZ) $oldTclTZ + } + if { [info exists oldTZ] } { + set env(TZ) $oldTZ + } ::tcl::clock::ClearCaches } \ -result [clock format 0 -locale current -timezone EST5 \ @@ -34773,6 +34801,14 @@ test clock-31.6 {system locale} \ namespace eval ::tcl::clock { namespace import -force ::testClock::registry } + if { [info exists env(TZ)] } { + set oldTZ $env(TZ) + unset env(TZ) + } + if { [info exists env(TCL_TZ)] } { + set oldTclTZ $env(TCL_TZ) + unset env(TCL_TZ) + } ::tcl::clock::ClearCaches } \ -body { @@ -34782,6 +34818,12 @@ test clock-31.6 {system locale} \ namespace eval ::tcl::clock { rename registry {} } + if { [info exists oldTclTZ] } { + set env(TCL_TZ) $oldTclTZ + } + if { [info exists oldTZ] } { + set env(TZ) $oldTZ + } ::tcl::clock::ClearCaches } \ -result [clock format 0 -locale current -timezone EST5 \ |