diff options
author | kennykb <kennykb@noemail.net> | 2005-08-12 23:55:27 (GMT) |
---|---|---|
committer | kennykb <kennykb@noemail.net> | 2005-08-12 23:55:27 (GMT) |
commit | dc89c9134e401bb61ecfbd9122d0e0c8a5801f8c (patch) | |
tree | bdfab0ac281a64d91630de66c881967982d44143 /library | |
parent | 300729bdd2cdb91d84970ff48908454765794bde (diff) | |
download | tcl-dc89c9134e401bb61ecfbd9122d0e0c8a5801f8c.zip tcl-dc89c9134e401bb61ecfbd9122d0e0c8a5801f8c.tar.gz tcl-dc89c9134e401bb61ecfbd9122d0e0c8a5801f8c.tar.bz2 |
bug 1257830
FossilOrigin-Name: 5e29d06ce18320850b1dd9fb153d50c8be5c125f
Diffstat (limited to 'library')
-rw-r--r-- | library/clock.tcl | 57 |
1 files changed, 41 insertions, 16 deletions
diff --git a/library/clock.tcl b/library/clock.tcl index 5ff786f..ccc55fd 100644 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -13,7 +13,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: clock.tcl,v 1.17 2005/07/15 22:32:24 kennykb Exp $ +# RCS: @(#) $Id: clock.tcl,v 1.18 2005/08/12 23:55:28 kennykb Exp $ # #---------------------------------------------------------------------- @@ -2926,18 +2926,18 @@ proc ::tcl::clock::GetSystemTimeZone {} { set timezone $result } elseif { ![catch {getenv TZ} result] } { 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 { - if { [info exists CachedSystemTimeZone] } { - set timezone $CachedSystemTimeZone - } else { - if { $::tcl_platform(platform) eq {windows} } { - set timezone [GuessWindowsTimeZone] - } else { - set timezone :localtime - } - set CachedSystemTimeZone $timezone - } + set timezone :localtime } + set CachedSystemTimeZone $timezone if { ![dict exists $TimeZoneBad $timezone] } { dict set TimeZoneBad $timezone [catch {SetupTimeZone $timezone}] } @@ -3314,7 +3314,7 @@ proc ::tcl::clock::SetupTimeZone { timezone } { # again with a time zone file - this time without a colon if { [catch { LoadTimeZoneFile $timezone }] - && [catch { LoadZoneinfoFile $timezone } - opts] } { + && [catch { ZoneinfoFile $timezone } - opts] } { dict unset opts -errorinfo return -options $opts "time zone $timezone not found" } @@ -3525,7 +3525,7 @@ proc ::tcl::clock::LoadTimeZoneFile { fileName } { # Loads a binary time zone information file in Olson format. # # Parameters: -# fileName - Path name of the file to load. +# fileName - Relative path name of the file to load. # # Results: # Returns an empty result normally; returns an error if no @@ -3538,8 +3538,6 @@ proc ::tcl::clock::LoadTimeZoneFile { fileName } { proc ::tcl::clock::LoadZoneinfoFile { fileName } { - variable MINWIDE - variable TZData variable ZoneinfoPaths # Since an unsafe interp uses the [clock] command in the master, @@ -3558,6 +3556,33 @@ proc ::tcl::clock::LoadZoneinfoFile { fileName } { } unset fname } + ReadZoneinfoFile $fileName $fname +} + +#---------------------------------------------------------------------- +# +# LoadZoneinfoFile -- +# +# Loads a binary time zone information file in Olson format. +# +# Parameters: +# fileName - Name of the time zone (relative path name of the +# file). +# fname - Absolute path name of the file. +# +# Results: +# Returns an empty result normally; returns an error if no +# Olson file was found or the file was malformed in some way. +# +# Side effects: +# TZData(:fileName) contains the time zone data +# +#---------------------------------------------------------------------- + + +proc ReadZoneinfoFile {fileName fname} { + variable MINWIDE + variable TZData if { ![info exists fname] } { return -code error "$fileName not found" } @@ -3643,7 +3668,7 @@ proc ::tcl::clock::LoadZoneinfoFile { fileName } { } set TZData(:$fileName) $r - + return } #---------------------------------------------------------------------- |