summaryrefslogtreecommitdiffstats
path: root/tests/clock.test
diff options
context:
space:
mode:
authormax <max@tclers.tk>2011-10-18 13:03:42 (GMT)
committermax <max@tclers.tk>2011-10-18 13:03:42 (GMT)
commit47b4d47e6ae7022e12935ae3a44b20f2faa26265 (patch)
treebb5a3063c8a46877d555ead210b5cbd650b4a0f7 /tests/clock.test
parentbca0615a494ac0a1746420810731b2a8b70c475e (diff)
downloadtcl-47b4d47e6ae7022e12935ae3a44b20f2faa26265.zip
tcl-47b4d47e6ae7022e12935ae3a44b20f2faa26265.tar.gz
tcl-47b4d47e6ae7022e12935ae3a44b20f2faa26265.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 7937933..917543a 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}