summaryrefslogtreecommitdiffstats
path: root/tests/clock.test
diff options
context:
space:
mode:
authormax <max@tclers.tk>2011-10-18 13:08:55 (GMT)
committermax <max@tclers.tk>2011-10-18 13:08:55 (GMT)
commitab5335a4c951b478bbedd4f5561b8a314da5b074 (patch)
treec0623b24025764f3cd3a377e5e33de81d5ccf90b /tests/clock.test
parent17f82d2daf4b9ae646c39c2922e7d73a7671ed05 (diff)
downloadtcl-ab5335a4c951b478bbedd4f5561b8a314da5b074.zip
tcl-ab5335a4c951b478bbedd4f5561b8a314da5b074.tar.gz
tcl-ab5335a4c951b478bbedd4f5561b8a314da5b074.tar.bz2
Don't cache the system timezone when it was derived from TCL_TZ or TZ.
Diffstat (limited to 'tests/clock.test')
-rw-r--r--tests/clock.test33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/clock.test b/tests/clock.test
index 8c31f83..bda5e76 100644
--- a/tests/clock.test
+++ b/tests/clock.test
@@ -35895,6 +35895,39 @@ test clock-38.1 {regression - convertUTCToLocalViaC - east of Greenwich} \
} \
-result {01:00:00}
+test clock-38.2 {make sure TZ is not cached after unset} \
+ -setup {
+ 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)
+ }
+ } \
+ -body {
+ set t1 [clock format 0]
+ # a time zone that is unlikely to anywhere
+ set env(TZ) "+04:20"
+ set t2 [clock format 0]
+ unset env(TZ)
+ set t3 [clock format 0]
+ expr {$t1 eq $t3 && $t1 ne $t2}
+ } \
+ -cleanup {
+ if { [info exists oldTZ] } {
+ set env(TZ) $oldTZ
+ unset oldTZ
+ }
+ if { [info exists oldTclTZ] } {
+ set env(TCL_TZ) $oldTclTZ
+ unset oldTclTZ
+ }
+ } \
+ -result 1
+
+
test clock-39.1 {regression - synonym timezones} {
clock format 0 -format {%H:%M:%S} -timezone :US/Eastern
} {19:00:00}