diff options
author | sebres <sebres@users.sourceforge.net> | 2017-06-02 20:09:53 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2017-06-02 20:09:53 (GMT) |
commit | 3a142b1b89b234ba6146d2c1a96840eda096f010 (patch) | |
tree | 4fc38d3521a464ed38ac443718a3608260670978 | |
parent | 8279312306565c5d37c23c95535cd828d15123db (diff) | |
download | tcl-3a142b1b89b234ba6146d2c1a96840eda096f010.zip tcl-3a142b1b89b234ba6146d2c1a96840eda096f010.tar.gz tcl-3a142b1b89b234ba6146d2c1a96840eda096f010.tar.bz2 |
[win32] repair clock using system timezone (default :localtime) resp. locale for windows (broken after removal of registry-fix in [848d01b6ef])
-rw-r--r-- | library/clock.tcl | 10 | ||||
-rw-r--r-- | tests/clock.test | 14 |
2 files changed, 11 insertions, 13 deletions
diff --git a/library/clock.tcl b/library/clock.tcl index bc648c5..7134cbc 100644 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -23,7 +23,15 @@ uplevel \#0 { package require msgcat 1.6 if { $::tcl_platform(platform) eq {windows} } { if { [catch { package require registry 1.1 }] } { - namespace eval ::tcl::clock [list variable NoRegistry {}] + # try to load registry directly from root (if uninstalled / development env): + if {![regexp {[/\\]library$} [info library]] || [catch { + load [lindex \ + [glob -tails -directory [file dirname [info nameofexecutable]] \ + tclreg*[expr {[::tcl::pkgconfig get debug] ? {g} : {}}].dll] 0 \ + ] registry + }]} { + namespace eval ::tcl::clock [list variable NoRegistry {}] + } } } } diff --git a/tests/clock.test b/tests/clock.test index 483d072..f055b80 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -18,20 +18,10 @@ if {[lsearch [namespace children] ::tcltest] == -1} { } if {[testConstraint win]} { - # for windows test cases using system locale / TZ :localtime if {[catch { - ::tcltest::loadTestedCommands - package require registry - }]} { - # try to load registry directly from root (uninstalled / development env): - if {[catch { - load [lindex \ - [glob -tails -directory [file dirname [info nameofexecutable]] \ - tclreg*[expr {[::tcl::pkgconfig get debug] ? {g} : {}}].dll] 0 \ - ] registry + ::tcltest::loadTestedCommands }]} { - namespace eval ::tcl::clock {variable NoRegistry {}} - } + # nothing to be done (registry loaded on demand) } } |