Tcl Source Code

Check-in [2b6aaefebf]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Don't cache the system timezone when it was derived from TCL_TZ or TZ.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2b6aaefebf099eff1e8be9730b678a0b8aad7270
User & Date: max 2011-10-18 13:08:55
Context
2011-10-20
14:37
Resolver fix from Stefan Sobernig. * generic/tclLiteral.c (TclInvalidateCmdLiteral): [Bug 3418547]:... check-in: 6941a89e57 user: dkf tags: trunk
2011-10-19
12:10
merge trunk Closed-Leaf check-in: b6b01c5365 user: dgp tags: remove-pathappend-intrep
2011-10-18
13:08
Don't cache the system timezone when it was derived from TCL_TZ or TZ. check-in: 2b6aaefebf user: max tags: trunk
2011-10-15
10:28
Update to Olson's tzdata2011l check-in: 95db49a59b user: venkat tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.








1
2
3
4
5
6
7







2011-10-15  Venkat Iyer <[email protected]>
	* library/tzdata/America/Sitka : Update to Olson's tzdata2011l
	* library/tzdata/Pacific/Fiji
	* library/tzdata/Asia/Hebron (New)

2011-10-11  Jan Nijtmans  <[email protected]>

>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
2011-10-18  Reinhard Max  <[email protected]>

	* library/clock.tcl (::tcl::clock::GetSystemTimeZone): Cache the
	time zone only if it was detected by one of the expensive
	methods. Otherwise after unsetting TCL_TZ or TZ the previous value
	will still be used.

2011-10-15  Venkat Iyer <[email protected]>
	* library/tzdata/America/Sitka : Update to Olson's tzdata2011l
	* library/tzdata/Pacific/Fiji
	* library/tzdata/Asia/Hebron (New)

2011-10-11  Jan Nijtmans  <[email protected]>

Changes to library/clock.tcl.

3008
3009
3010
3011
3012
3013
3014




3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026

3027
3028
3029
3030
3031
3032
3033
    variable CachedSystemTimeZone
    variable TimeZoneBad

    if {[set result [getenv TCL_TZ]] ne {}} {
	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 { ![dict exists $TimeZoneBad $timezone] } {
	dict set TimeZoneBad $timezone [catch {SetupTimeZone $timezone}]
    }
    if { [dict get $TimeZoneBad $timezone] } {
	return :localtime
    } else {
	return $timezone







>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
>







3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
    variable CachedSystemTimeZone
    variable TimeZoneBad

    if {[set result [getenv TCL_TZ]] ne {}} {
	set timezone $result
    } elseif {[set result [getenv TZ]] ne {}} {
	set timezone $result
    }
    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}]
    }
    if { [dict get $TimeZoneBad $timezone] } {
	return :localtime
    } else {
	return $timezone

Changes to tests/clock.test.

35890
35891
35892
35893
35894
35895
35896

































35897
35898
35899
35900
35901
35902
35903
	    set env(TZ) $oldTZ
	    unset oldTZ
	} else {
	    unset env(TZ)
	}
    } \
    -result {01:00:00}


































test clock-39.1 {regression - synonym timezones} {
    clock format 0 -format {%H:%M:%S} -timezone :US/Eastern
} {19:00:00}

test clock-40.1 {regression - bad month with -timezone :localtime} \
    -setup {







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







35890
35891
35892
35893
35894
35895
35896
35897
35898
35899
35900
35901
35902
35903
35904
35905
35906
35907
35908
35909
35910
35911
35912
35913
35914
35915
35916
35917
35918
35919
35920
35921
35922
35923
35924
35925
35926
35927
35928
35929
35930
35931
35932
35933
35934
35935
35936
	    set env(TZ) $oldTZ
	    unset oldTZ
	} else {
	    unset env(TZ)
	}
    } \
    -result {01:00:00}

test clock-38.2 {make sure TZ is not cached after unset} \
    -setup {
	if { [info exists env(TZ)] } {
	    set oldTZ $env(TZ)
            unset env(TZ)
	}
	if { [info exists env(TCL_TZ)] } {
	    set oldTCLTZ $env(TCL_TZ)
            unset env(TCL_TZ)
	}
    } \
    -body {
        set t1 [clock format 0]
        # a time zone that is unlikely to anywhere
        set env(TZ) "+04:20"
        set t2 [clock format 0]
        unset env(TZ)
        set t3 [clock format 0]
        expr {$t1 eq $t3 && $t1 ne $t2}
    } \
    -cleanup {
        if { [info exists oldTZ] } {
            set env(TZ) $oldTZ
            unset oldTZ
        }
        if { [info exists oldTclTZ] } {
            set env(TCL_TZ) $oldTclTZ
            unset oldTclTZ
        }
    } \
    -result 1
        

test clock-39.1 {regression - synonym timezones} {
    clock format 0 -format {%H:%M:%S} -timezone :US/Eastern
} {19:00:00}

test clock-40.1 {regression - bad month with -timezone :localtime} \
    -setup {