diff options
author | max <max@tclers.tk> | 2011-10-18 13:08:55 (GMT) |
---|---|---|
committer | max <max@tclers.tk> | 2011-10-18 13:08:55 (GMT) |
commit | 04f7ea535529ba7fea3bbeaf19ed04672c48e6ff (patch) | |
tree | c0623b24025764f3cd3a377e5e33de81d5ccf90b /library | |
parent | 69c48d447c35867c75397d277795f53580a82849 (diff) | |
download | tcl-04f7ea535529ba7fea3bbeaf19ed04672c48e6ff.zip tcl-04f7ea535529ba7fea3bbeaf19ed04672c48e6ff.tar.gz tcl-04f7ea535529ba7fea3bbeaf19ed04672c48e6ff.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 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}] } |