diff options
author | max <max@tclers.tk> | 2011-10-18 13:03:42 (GMT) |
---|---|---|
committer | max <max@tclers.tk> | 2011-10-18 13:03:42 (GMT) |
commit | 47b4d47e6ae7022e12935ae3a44b20f2faa26265 (patch) | |
tree | bb5a3063c8a46877d555ead210b5cbd650b4a0f7 /library | |
parent | bca0615a494ac0a1746420810731b2a8b70c475e (diff) | |
download | tcl-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 'library')
-rw-r--r-- | library/clock.tcl | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/library/clock.tcl b/library/clock.tcl index 8bce49f..2e9cae7 100644 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -3076,18 +3076,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}] } |