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 | da6099c4aee8ad8a537e6dc5354e8bbe32913dac (patch) | |
tree | bb5a3063c8a46877d555ead210b5cbd650b4a0f7 /library/clock.tcl | |
parent | 918a89f9a97e677296ce27561f83105823452747 (diff) | |
download | tcl-da6099c4aee8ad8a537e6dc5354e8bbe32913dac.zip tcl-da6099c4aee8ad8a537e6dc5354e8bbe32913dac.tar.gz tcl-da6099c4aee8ad8a537e6dc5354e8bbe32913dac.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.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}] } |