summaryrefslogtreecommitdiffstats
path: root/library/clock.tcl
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 /library/clock.tcl
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 'library/clock.tcl')
-rw-r--r--library/clock.tcl27
1 files changed, 16 insertions, 11 deletions
diff --git a/library/clock.tcl b/library/clock.tcl
index b6ff359..2a4c7bd 100644
--- a/library/clock.tcl
+++ b/library/clock.tcl
@@ -3012,18 +3012,23 @@ proc ::tcl::clock::GetSystemTimeZone {} {
set timezone $result
} elseif {[set result [getenv TZ]] ne {}} {
set timezone $result
- } elseif { [info exists CachedSystemTimeZone] } {
- set timezone $CachedSystemTimeZone
- } elseif { $::tcl_platform(platform) eq {windows} } {
- set timezone [GuessWindowsTimeZone]
- } elseif { [file exists /etc/localtime]
- && ![catch {ReadZoneinfoFile \
- Tcl/Localtime /etc/localtime}] } {
- set timezone :Tcl/Localtime
- } else {
- set timezone :localtime
}
- set CachedSystemTimeZone $timezone
+ if {![info exists timezone]} {
+ # Cache the time zone only if it was detected by one of the
+ # expensive methods.
+ if { [info exists CachedSystemTimeZone] } {
+ set timezone $CachedSystemTimeZone
+ } elseif { $::tcl_platform(platform) eq {windows} } {
+ set timezone [GuessWindowsTimeZone]
+ } elseif { [file exists /etc/localtime]
+ && ![catch {ReadZoneinfoFile \
+ Tcl/Localtime /etc/localtime}] } {
+ set timezone :Tcl/Localtime
+ } else {
+ set timezone :localtime
+ }
+ set CachedSystemTimeZone $timezone
+ }
if { ![dict exists $TimeZoneBad $timezone] } {
dict set TimeZoneBad $timezone [catch {SetupTimeZone $timezone}]
}