summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2005-12-02 19:47:36 (GMT)
committerKevin B Kenny <kennykb@acm.org>2005-12-02 19:47:36 (GMT)
commit085b704108e13ba22ac2ce549e259e291740ad68 (patch)
treeeae86bd35d2cef8310355be5ec48797028345bec
parent0d8b2ac3539d436923694d412ddc74beb3d2f31f (diff)
downloadtcl-085b704108e13ba22ac2ce549e259e291740ad68.zip
tcl-085b704108e13ba22ac2ce549e259e291740ad68.tar.gz
tcl-085b704108e13ba22ac2ce549e259e291740ad68.tar.bz2
another little speedup to [clock format]
-rw-r--r--ChangeLog4
-rw-r--r--library/clock.tcl11
2 files changed, 10 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 6a6a274..bd8f205 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,7 +2,9 @@
* library/clock.tcl: Moved a tiny bit more of [clock format] from
run time to compile time, and fixed a l10n bug in the process.
- [Bug 1371446]
+ [Bug 1371446]. Also, conditoned the call to SetupTimeZone to speed
+ the common case where TZData($timezone) already exists.
+
* unix/Makefile.in: Made some changes to support a 'make' command
that is present on some antiquated versions of Solaris.
diff --git a/library/clock.tcl b/library/clock.tcl
index 0c8bdaa..95924ae 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.26 2005/12/02 16:58:13 kennykb Exp $
+# RCS: @(#) $Id: clock.tcl,v 1.27 2005/12/02 19:47:36 kennykb Exp $
#
#----------------------------------------------------------------------
@@ -652,6 +652,7 @@ proc ::tcl::clock::Initialize {} {
proc ::tcl::clock::format { args } {
+ variable TZData
set format {}
# Check the count of args
@@ -724,9 +725,11 @@ proc ::tcl::clock::format { args } {
if {$timezone eq ""} {
set timezone [GetSystemTimeZone]
}
- if {[catch {SetupTimeZone $timezone} retval opts]} {
- dict unset opts -errorinfo
- return -options $opts $retval
+ if {![info exists TZData($timezone)]} {
+ if {[catch {SetupTimeZone $timezone} retval opts]} {
+ dict unset opts -errorinfo
+ return -options $opts $retval
+ }
}
# Format the result