From 085b704108e13ba22ac2ce549e259e291740ad68 Mon Sep 17 00:00:00 2001 From: Kevin B Kenny Date: Fri, 2 Dec 2005 19:47:36 +0000 Subject: another little speedup to [clock format] --- ChangeLog | 4 +++- library/clock.tcl | 11 +++++++---- 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 -- cgit v0.12