summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2007-03-08 02:53:23 (GMT)
committerKevin B Kenny <kennykb@acm.org>2007-03-08 02:53:23 (GMT)
commit61777d36de5cd558281849888e89de68714ec952 (patch)
treef8f26e6bfd8c0780f67d1481408802807af90a69
parentb4d30d8f092b0a797c724113a993105db0367619 (diff)
downloadtcl-61777d36de5cd558281849888e89de68714ec952.zip
tcl-61777d36de5cd558281849888e89de68714ec952.tar.gz
tcl-61777d36de5cd558281849888e89de68714ec952.tar.bz2
* library/clock.tcl: Further tweaks to the Windows time zone table
(restoring missing Mexican time zones). Added rudimentary handling of version-2 'zoneinfo' files. Update US DST rules so that zones such as 'EST5EDT' get the correct transition dates. * tests/clock.test: Added rudimentary test cases for 'zoneinfo' parsing. Adjusted several tests that depended on obsolete US DST transition rules.
-rw-r--r--ChangeLog46
-rw-r--r--library/clock.tcl194
-rw-r--r--tests/clock.test227
3 files changed, 320 insertions, 147 deletions
diff --git a/ChangeLog b/ChangeLog
index 20756da..d444e2d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2007-03-08 Kevin B. Kenny <kennykb@acm.org>
+
+ * library/clock.tcl: Further tweaks to the Windows time zone table
+ (restoring missing Mexican time zones). Added rudimentary handling of
+ version-2 'zoneinfo' files. Update US DST rules so that zones
+ such as 'EST5EDT' get the correct transition dates.
+ * tests/clock.test: Added rudimentary test cases for 'zoneinfo'
+ parsing. Adjusted several tests that depended on obsolete
+ US DST transition rules.
+
2007-03-07 Daniel Steffen <das@users.sourceforge.net>
* macosx/tclMacOSXNotify.c: add spinlock debugging and sanity checks.
@@ -27,7 +37,7 @@
* generic/tclRegexp.c (TclRegAbout): Generate information about a
regexp as a Tcl_Obj instead of as a string, which is more efficient.
-2007-03-07 Kevin Kenny <kennykb@acm.org>
+2007-03-07 Kevin B. Kenny <kennykb@acm.org>
* library/clock.tcl: Adjusted Windows time zone table to handle new US
DST rules by locale rather than as Posix time zone spec.
@@ -179,7 +189,7 @@
policy decisions on what should and shouldn't be safe commands from
the "new in 8.5" set.
-2007-02-13 Kevin Kenny <kennykb@acm.org>
+2007-02-13 Kevin B. Kenny <kennykb@acm.org>
* tools/fix_tommath_h.tcl: Further tweaking for the x86-64. The change
is to make 'mp_digit' be an 'unsigned int' on that platform; since
@@ -192,7 +202,7 @@
* doc/re_syntax.n: Corrected description of 'print' class [Bug
1614687] and enhanced description of 'graph' class.
-2007-02-12 Kevin Kenny <kennykb@acm.org>
+2007-02-12 Kevin B. Kenny <kennykb@acm.org>
* tools/fix_tommath_h.tcl: Added code to patch out a check for
__x86_64__ that caused Tommath to use __attributes(TI)__ for the
@@ -374,7 +384,7 @@
* tests/lindex.test (lindex-9.2): Fix silly bug that ended up
sometimes compiling list arguments in the wrong order. [Bug 1631364]
-2007-01-03 Kevin Kenny <kennykb@acm.org>
+2007-01-03 Kevin B. Kenny <kennykb@acm.org>
* generic/tclDate.c: Regenerated to recover a lost fix from patthoyts.
[Bug 1618523]
@@ -516,7 +526,7 @@
* tests/mathop.test: routines some of routines that compile
the new TIP 174 commands. This corrects some known bugs. More to come.
-2006-12-06 Kevin Kenny <kennykb@acm.org>
+2006-12-06 Kevin B. Kenny <kennykb@acm.org>
* tests/expr.test (expr-47.12): Improved error reporting in hopes of
having more information to pursue [Bug 1609936].
@@ -584,7 +594,7 @@
* doc/file.n: Clarification of [file pathtype] docs. [Bug 1606454]
-2006-12-01 Kevin Kenny <kennykb@acm.org>
+2006-12-01 Kevin B. Kenny <kennykb@acm.org>
* libtommath/bn_mp_add.c: Corrected the effects of a
* libtommath/bn_mp_div.c: bollixed 'cvs merge' operation
@@ -624,7 +634,7 @@
* generic/tclExecute.c: Update callers.
* generic/tclMathOp.c:
-2006-11-30 Kevin Kenny <kennykb@acm.org>
+2006-11-30 Kevin B. Kenny <kennykb@acm.org>
* library/tzdata: Olson's tzdata2006p.
* libtommath/bn_mp_sqrt.c: Fixed a bug where the initial approximation
@@ -659,7 +669,7 @@
* tests/platform.test:
* tests/safe.test:
-2006-11-27 Kevin Kenny <kennykb@acm.org>
+2006-11-27 Kevin B. Kenny <kennykb@acm.org>
* unix/tclUnixChan.c (TclUnixWaitForFile):
* tests/event.test (event-14.*): Corrected a bug where
@@ -794,7 +804,7 @@
* generic/tclNamesp.c: [namespace import] with 0 arguments introspects
the list of imported commands.
-2006-11-13 Kevin Kenny <kennykb@users.sourceforge.net>
+2006-11-13 Kevin B. Kenny <kennykb@users.sourceforge.net>
* generic/tclThreadStorage.c (Tcl_InitThreadStorage):
(Tcl_FinalizeThreadStorage): Silence a compiler warning about
@@ -1334,11 +1344,11 @@
* tests/append.test(4.21-22): fix for longstanding [Bug 1570718],
lappending nothing to non-list. Reported by lvirden
-2006-10-04 Kevin Kenny <kennykb@acm.org>
+2006-10-04 Kevin B. Kenny <kennykb@acm.org>
* tzdata/: Olson's tzdata2006m.
-2006-10-01 Kevin Kenny <kennykb@acm.org>
+2006-10-01 Kevin B. Kenny <kennykb@acm.org>
* tests/clock.test (clock-49.2): Removed a locale dependency that
caused a spurious failure in the German locale. [Bug 1567956]
@@ -1439,7 +1449,7 @@
TCL_GLOBMODE_TAILS and pathPrefix==NULL. This would cause a segfault,
as found by coverity #26.
-2006-09-26 Kevin Kenny <kennykb@acm.org>
+2006-09-26 Kevin B. Kenny <kennykb@acm.org>
* doc/Encoding.3: Added covariant 'const' qualifier for the
* generic/tcl.decls: Tcl_EncodingType argument to
@@ -1589,7 +1599,7 @@
* tests/msgcat.test: Bumped version in auxiliary files as well.
* doc/msgcat.n:
-2006-09-11 Kevin Kenny <kennykb@acm.org>
+2006-09-11 Kevin B. Kenny <kennykb@acm.org>
* unix/Makefile.in: Bumped msgcat version to 1.4.2 to be
* win/Makefile.in: consistent with dgp's commits of 2006-09-10.
@@ -1743,7 +1753,7 @@
* win/tclWinFCmd.c:
* win/tclWinFile.c:
-2006-08-28 Kevin Kenny <kennykb@acm.org>
+2006-08-28 Kevin B. Kenny <kennykb@acm.org>
* library/tzdata/America/Havana: Regenerated from Olson's
* library/tzdata/America/Tegucigalpa: tzdata2006k.
@@ -1775,7 +1785,7 @@
[namespace upvar] as follow up to [Bug 1546833], reported by Will
Duquette.
-2006-08-24 Kevin Kenny <kennykb@acm.org>
+2006-08-24 Kevin B. Kenny <kennykb@acm.org>
* library/tzdata: Regenerated, including several new files,
from Olson's tzdata2006j.
@@ -1947,13 +1957,13 @@
* tests/parseExpr.test: tests in the testsuite that are caused by
* tests/while.test: the new expression parser error messages.
-2006-07-31 Kevin Kenny <kennykb@acm.org>
+2006-07-31 Kevin B. Kenny <kennykb@acm.org>
* generic/tclClock.c (ConvertLocalToUTCUsingC): Corrected a regression
that caused dates before 1969 to be one day off in the :localtime time
zone if TZ is not set. [Bug 1531530]
-2006-07-30 Kevin Kenny <kennykb@acm.org>
+2006-07-30 Kevin B. Kenny <kennykb@acm.org>
* generic/tclClock.c (GetJulianDayFromEraYearMonthDay): Corrected
several errors in converting dates before the Common Era. [Bug 1426279]
@@ -2404,7 +2414,7 @@
* generic/tclExecute.c: Corrections to INST_EXPON detection of overflow
to use mp_int calculations.
-2006-03-24 Kevin Kenny <kennykb@acm.org>
+2006-03-24 Kevin B. Kenny <kennykb@acm.org>
* generic/tclExecute.c (TclExecuteByteCode): Added a couple of missing
casts to 'int' that were affecting compilablity on VC6.
diff --git a/library/clock.tcl b/library/clock.tcl
index 6914de4..1a7c079 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.38 2007/03/07 00:28:05 kennykb Exp $
+# RCS: @(#) $Id: clock.tcl,v 1.39 2007/03/08 02:53:23 kennykb Exp $
#
#----------------------------------------------------------------------
@@ -243,7 +243,6 @@ proc ::tcl::clock::Initialize {} {
/usr/share/lib/zoneinfo
/usr/lib/zoneinfo
/usr/local/etc/zoneinfo
- C:/Progra~1/cygwin/usr/local/etc/zoneinfo
} {
if { [file isdirectory $path] } {
lappend ZoneinfoPaths $path
@@ -304,77 +303,82 @@ proc ::tcl::clock::Initialize {} {
# been made to make a reasonable guess, but this table needs to be
# taken with a grain of salt.
- variable WinZoneInfo [dict create \
- {-43200 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Pacific/Kwajalein \
- {-39600 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Pacific/Midway \
- {-36000 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Pacific/Honolulu \
- {-32400 0 3600 0 11 0 1 2 0 0 0 0 3 0 2 2 0 0 0} :America/Anchorage \
- {-28800 0 3600 0 11 0 1 2 0 0 0 0 3 0 2 2 0 0 0} :America/Los_Angeles \
- {-25200 0 3600 0 11 0 1 2 0 0 0 0 3 0 2 2 0 0 0} :America/Denver \
- {-25200 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :America/Phoenix \
- {-21600 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :America/Regina \
- {-21600 0 3600 0 11 0 1 2 0 0 0 0 3 0 2 2 0 0 0} :America/Chicago \
- {-18000 0 3600 0 11 0 1 2 0 0 0 0 3 0 2 2 0 0 0} :America/New_York \
- {-18000 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :America/Indianapolis \
- {-14400 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :America/Caracas \
- {-14400 0 3600 0 3 6 2 23 59 59 999 0 10 6 2 23 59 59 999} \
- :America/Santiago \
- {-14400 0 3600 0 2 0 5 2 0 0 0 0 11 0 1 2 0 0 0} :America/Manaus \
- {-14400 0 3600 0 10 0 5 2 0 0 0 0 4 0 1 2 0 0 0} :America/Halifax \
- {-12600 0 3600 0 10 0 5 2 0 0 0 0 4 0 1 2 0 0 0} :America/St_Johns \
- {-10800 0 3600 0 2 0 2 2 0 0 0 0 10 0 3 2 0 0 0} :America/Sao_Paulo \
- {-10800 0 3600 0 10 0 5 2 0 0 0 0 4 0 1 2 0 0 0} :America/Godthab \
- {-10800 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :America/Buenos_Aires \
- {-10800 0 3600 0 2 0 5 2 0 0 0 0 11 0 1 2 0 0 0} :America/Brasilia \
- {-10800 0 3600 0 3 0 2 2 0 0 0 0 10 0 1 2 0 0 0} :America/Montevideo \
- {-7200 0 3600 0 9 0 5 2 0 0 0 0 3 0 5 2 0 0 0} :America/Noronha \
- {-3600 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Atlantic/Azores \
- {-3600 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Atlantic/Cape_Verde \
- {0 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :UTC \
- {0 0 3600 0 10 0 5 2 0 0 0 0 3 0 5 1 0 0 0} :Europe/London \
- {3600 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Africa/Kinshasa \
- {3600 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :CET \
- {7200 0 3600 0 9 4 5 23 59 59 0 0 4 4 5 23 59 59 0} \
- :Africa/Cairo \
- {7200 0 3600 0 10 0 5 4 0 0 0 0 3 0 5 3 0 0 0} :Europe/Helsinki \
- {7200 0 3600 0 9 0 3 2 0 0 0 0 3 5 5 2 0 0 0} :Asia/Jerusalem \
- {7200 0 3600 0 9 0 5 1 0 0 0 0 3 0 5 0 0 0 0} :Europe/Bucharest \
- {7200 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Europe/Athens \
- {7200 0 3600 0 9 5 5 1 0 0 0 0 3 4 5 0 0 0 0} :Asia/Amman \
- {7200 0 3600 0 10 6 5 23 59 59 999 0 3 0 5 0 0 0 0} \
- :Asia/Beirut \
- {7200 0 -3600 0 4 0 1 2 0 0 0 0 9 0 1 2 0 0 0} :Africa/Windhoek \
- {10800 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Riyadh \
- {10800 0 3600 0 10 0 1 4 0 0 0 0 4 0 1 3 0 0 0} :Asia/Baghdad \
- {10800 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Europe/Moscow \
- {12600 0 3600 0 9 2 4 2 0 0 0 0 3 0 1 2 0 0 0} :Asia/Tehran \
- {14400 0 3600 0 10 0 5 5 0 0 0 0 3 0 5 4 0 0 0} :Asia/Baku \
- {14400 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Muscat \
- {14400 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Asia/Tbilisi \
- {16200 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Kabul \
- {18000 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Karachi \
- {18000 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Asia/Yekaterinburg \
- {19800 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Calcutta \
- {20700 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Katmandu \
- {21600 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Dhaka \
- {21600 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Asia/Novosibirsk \
- {23400 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Rangoon \
- {25200 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Bangkok \
- {25200 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Asia/Krasnoyarsk \
- {28800 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Chongqing \
- {28800 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Asia/Irkutsk \
- {32400 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Tokyo \
- {32400 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Asia/Yakutsk \
- {34200 0 3600 0 3 0 5 3 0 0 0 0 10 0 5 2 0 0 0} :Australia/Adelaide \
- {34200 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Australia/Darwin \
- {36000 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Australia/Brisbane \
- {36000 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Asia/Vladivostok \
- {36000 0 3600 0 3 0 5 3 0 0 0 0 10 0 1 2 0 0 0} :Australia/Hobart \
- {36000 0 3600 0 3 0 5 3 0 0 0 0 10 0 5 2 0 0 0} :Australia/Sydney \
- {39600 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Pacific/Noumea \
- {43200 0 3600 0 3 0 3 3 0 0 0 0 10 0 1 2 0 0 0} :Pacific/Auckland \
- {43200 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Pacific/Fiji \
- {46800 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Pacific/Tongatapu]
+ variable WinZoneInfo [dict create {*}{
+ {-43200 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Pacific/Kwajalein
+ {-39600 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Pacific/Midway
+ {-36000 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Pacific/Honolulu
+ {-32400 0 3600 0 11 0 1 2 0 0 0 0 3 0 2 2 0 0 0} :America/Anchorage
+ {-28800 0 3600 0 11 0 1 2 0 0 0 0 3 0 2 2 0 0 0} :America/Los_Angeles
+ {-28800 0 3600 0 10 0 5 2 0 0 0 0 4 0 1 2 0 0 0} :America/Tijuana
+ {-25200 0 3600 0 11 0 1 2 0 0 0 0 3 0 2 2 0 0 0} :America/Denver
+ {-25200 0 3600 0 10 0 5 2 0 0 0 0 4 0 1 2 0 0 0} :America/Chihuahua
+ {-25200 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :America/Phoenix
+ {-21600 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :America/Regina
+ {-21600 0 3600 0 11 0 1 2 0 0 0 0 3 0 2 2 0 0 0} :America/Chicago
+ {-21600 0 3600 0 10 0 5 2 0 0 0 0 4 0 1 2 0 0 0} :America/Mexico_City
+ {-18000 0 3600 0 11 0 1 2 0 0 0 0 3 0 2 2 0 0 0} :America/New_York
+ {-18000 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :America/Indianapolis
+ {-14400 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :America/Caracas
+ {-14400 0 3600 0 3 6 2 23 59 59 999 0 10 6 2 23 59 59 999}
+ :America/Santiago
+ {-14400 0 3600 0 2 0 5 2 0 0 0 0 11 0 1 2 0 0 0} :America/Manaus
+ {-14400 0 3600 0 11 0 1 2 0 0 0 0 3 0 2 2 0 0 0} :America/Halifax
+ {-12600 0 3600 0 10 0 5 2 0 0 0 0 4 0 1 2 0 0 0} :America/St_Johns
+ {-10800 0 3600 0 2 0 2 2 0 0 0 0 10 0 3 2 0 0 0} :America/Sao_Paulo
+ {-10800 0 3600 0 10 0 5 2 0 0 0 0 4 0 1 2 0 0 0} :America/Godthab
+ {-10800 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :America/Buenos_Aires
+ {-10800 0 3600 0 2 0 5 2 0 0 0 0 11 0 1 2 0 0 0} :America/Brasilia
+ {-10800 0 3600 0 3 0 2 2 0 0 0 0 10 0 1 2 0 0 0} :America/Montevideo
+ {-7200 0 3600 0 9 0 5 2 0 0 0 0 3 0 5 2 0 0 0} :America/Noronha
+ {-3600 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Atlantic/Azores
+ {-3600 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Atlantic/Cape_Verde
+ {0 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :UTC
+ {0 0 3600 0 10 0 5 2 0 0 0 0 3 0 5 1 0 0 0} :Europe/London
+ {3600 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Africa/Kinshasa
+ {3600 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :CET
+ {7200 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Africa/Harare
+ {7200 0 3600 0 9 4 5 23 59 59 0 0 4 4 5 23 59 59 0}
+ :Africa/Cairo
+ {7200 0 3600 0 10 0 5 4 0 0 0 0 3 0 5 3 0 0 0} :Europe/Helsinki
+ {7200 0 3600 0 9 0 3 2 0 0 0 0 3 5 5 2 0 0 0} :Asia/Jerusalem
+ {7200 0 3600 0 9 0 5 1 0 0 0 0 3 0 5 0 0 0 0} :Europe/Bucharest
+ {7200 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Europe/Athens
+ {7200 0 3600 0 9 5 5 1 0 0 0 0 3 4 5 0 0 0 0} :Asia/Amman
+ {7200 0 3600 0 10 6 5 23 59 59 999 0 3 0 5 0 0 0 0}
+ :Asia/Beirut
+ {7200 0 -3600 0 4 0 1 2 0 0 0 0 9 0 1 2 0 0 0} :Africa/Windhoek
+ {10800 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Riyadh
+ {10800 0 3600 0 10 0 1 4 0 0 0 0 4 0 1 3 0 0 0} :Asia/Baghdad
+ {10800 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Europe/Moscow
+ {12600 0 3600 0 9 2 4 2 0 0 0 0 3 0 1 2 0 0 0} :Asia/Tehran
+ {14400 0 3600 0 10 0 5 5 0 0 0 0 3 0 5 4 0 0 0} :Asia/Baku
+ {14400 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Muscat
+ {14400 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Asia/Tbilisi
+ {16200 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Kabul
+ {18000 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Karachi
+ {18000 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Asia/Yekaterinburg
+ {19800 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Calcutta
+ {20700 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Katmandu
+ {21600 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Dhaka
+ {21600 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Asia/Novosibirsk
+ {23400 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Rangoon
+ {25200 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Bangkok
+ {25200 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Asia/Krasnoyarsk
+ {28800 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Chongqing
+ {28800 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Asia/Irkutsk
+ {32400 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Tokyo
+ {32400 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Asia/Yakutsk
+ {34200 0 3600 0 3 0 5 3 0 0 0 0 10 0 5 2 0 0 0} :Australia/Adelaide
+ {34200 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Australia/Darwin
+ {36000 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Australia/Brisbane
+ {36000 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Asia/Vladivostok
+ {36000 0 3600 0 3 0 5 3 0 0 0 0 10 0 1 2 0 0 0} :Australia/Hobart
+ {36000 0 3600 0 3 0 5 3 0 0 0 0 10 0 5 2 0 0 0} :Australia/Sydney
+ {39600 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Pacific/Noumea
+ {43200 0 3600 0 3 0 3 3 0 0 0 0 10 0 1 2 0 0 0} :Pacific/Auckland
+ {43200 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Pacific/Fiji
+ {46800 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Pacific/Tongatapu
+ }]
# Groups of fields that specify the date, priorities, and
# code bursts that determine Julian Day Number given those groups.
@@ -3555,24 +3559,50 @@ proc ReadZoneinfoFile {fileName fname} {
# The file begins with a magic number, sixteen reserved bytes,
# and then six 4-byte integers giving counts of fileds in the file.
- binary scan $d a4x16IIIIII magic nIsGMT mIsStd nLeap nTime nType nChar
+ binary scan $d a4a1x15IIIIII \
+ magic version nIsGMT nIsStd nLeap nTime nType nChar
set seek 44
+ set ilen 4
+ set iformat I
if { $magic != {TZif} } {
return -code error "$fileName not a time zone information file"
}
if { $nType > 255 } {
return -code error "$fileName contains too many time types"
}
+ # Accept only Posix-style zoneinfo. Sorry, 'leaps' bigots.
if { $nLeap != 0 } {
return -code error "$fileName contains leap seconds"
}
+ # In a version 2 file, we use the second part of the file, which
+ # contains 64-bit transition times.
+
+ if {$version eq "2"} {
+ set seek [expr {44
+ + 5 * $nTime
+ + 6 * $nType
+ + 4 * $nLeap
+ + $nIsStd
+ + $nIsGMT
+ + $nChar
+ }]
+ binary scan $d @${seek}a4a1x15IIIIII \
+ magic version nIsGMT nIsStd nLeap nTime nType nChar
+ if {$magic ne {TZif}} {
+ return -code error "seek address $seek miscomputed, magic = $magic"
+ }
+ set iformat W
+ set ilen 8
+ incr seek 44
+ }
+
# Next come ${nTime} transition times, followed by ${nTime} time type
# codes. The type codes are unsigned 1-byte quantities. We insert an
# arbitrary start time in front of the transitions.
- binary scan $d @${seek}I${nTime}c${nTime} times tempCodes
- incr seek [expr { 5 * $nTime }]
+ binary scan $d @${seek}${iformat}${nTime}c${nTime} times tempCodes
+ incr seek [expr { ($ilen + 1) * $nTime }]
set times [linsert $times 0 $MINWIDE]
set codes {}
foreach c $tempCodes {
@@ -3622,6 +3652,10 @@ proc ReadZoneinfoFile {fileName fname} {
}
set TZData(:$fileName) $r
+
+ # TODO - The end of a version 2 zoneinfo file has a Posiz TZ spec
+ # that can be used to fill out the rules past the End of Time.
+
return
}
@@ -3896,8 +3930,8 @@ proc ::tcl::clock::ProcessPosixTimeZone { z } {
if { [dict get $z startDayOfYear] eq {}
&& [dict get $z startMonth] eq {} } {
- dict set z startMonth 4
- dict set z startWeekOfMonth 1
+ dict set z startMonth 3
+ dict set z startWeekOfMonth 2
dict set z startDayOfWeek 0
dict set z startHours 2
dict set z startMinutes 0
@@ -3905,8 +3939,8 @@ proc ::tcl::clock::ProcessPosixTimeZone { z } {
}
if { [dict get $z endDayOfYear] eq {}
&& [dict get $z endMonth] eq {} } {
- dict set z endMonth 10
- dict set z endWeekOfMonth 5
+ dict set z endMonth 11
+ dict set z endWeekOfMonth 1
dict set z endDayOfWeek 0
dict set z endHours 2
dict set z endMinutes 0
diff --git a/tests/clock.test b/tests/clock.test
index 521fc4d..694f02e 100644
--- a/tests/clock.test
+++ b/tests/clock.test
@@ -11,7 +11,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.test,v 1.70 2007/03/07 00:28:06 kennykb Exp $
+# RCS: @(#) $Id: clock.test,v 1.71 2007/03/08 02:53:23 kennykb Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -35046,56 +35046,78 @@ test clock-30.9 {clock add days} {
} {{2000-01-02 12:34:56} {1999-12-31 12:34:56}}
test clock-30.10 {clock add days, spring DST conversion, before} {
set t [clock scan {2004-04-03 01:59:59} -format {%Y-%m-%d %H:%M:%S} \
- -timezone EST5EDT]
- set f1 [clock add $t 1 day -timezone EST5EDT]
- set f2 [clock add $t 2 days -timezone EST5EDT]
- set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} -timezone EST5EDT]
- set x2 [clock format $f2 -format {%Y-%m-%d %H:%M:%S %z} -timezone EST5EDT]
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set f1 [clock add $t 1 day \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set f2 [clock add $t 2 days \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set x2 [clock format $f2 -format {%Y-%m-%d %H:%M:%S %z} \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
list $x1 $x2
} {{2004-04-04 01:59:59 -0500} {2004-04-05 01:59:59 -0400}}
test clock-30.11 {clock add days, spring DST conversion, bad case} {
set t [clock scan {2004-04-03 02:30:00} -format {%Y-%m-%d %H:%M:%S} \
- -timezone EST5EDT]
- set f1 [clock add $t 1 day -timezone EST5EDT]
- set f2 [clock add $t 2 day -timezone EST5EDT]
- set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} -timezone EST5EDT]
- set x2 [clock format $f2 -format {%Y-%m-%d %H:%M:%S %z} -timezone EST5EDT]
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set f1 [clock add $t 1 day \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set f2 [clock add $t 2 day \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set x2 [clock format $f2 -format {%Y-%m-%d %H:%M:%S %z} \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
list $x1 $x2
} {{2004-04-04 03:30:00 -0400} {2004-04-05 02:30:00 -0400}}
test clock-30.12 {clock add days, spring DST conversion, after} {
set t [clock scan {2004-04-03 03:00:00} -format {%Y-%m-%d %H:%M:%S} \
- -timezone EST5EDT]
- set f1 [clock add $t 1 day -timezone EST5EDT]
- set f2 [clock add $t 2 day -timezone EST5EDT]
- set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} -timezone EST5EDT]
- set x2 [clock format $f2 -format {%Y-%m-%d %H:%M:%S %z} -timezone EST5EDT]
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set f1 [clock add $t 1 day -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set f2 [clock add $t 2 day -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set x2 [clock format $f2 -format {%Y-%m-%d %H:%M:%S %z} \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
list $x1 $x2
} {{2004-04-04 03:00:00 -0400} {2004-04-05 03:00:00 -0400}}
test clock-30.13 {clock add days, fall DST conversion, before} {
set t [clock scan {2004-10-30 00:59:59} -format {%Y-%m-%d %H:%M:%S} \
- -timezone EST5EDT]
- set f1 [clock add $t 1 day -timezone EST5EDT]
- set f2 [clock add $t 2 day -timezone EST5EDT]
- set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} -timezone EST5EDT]
- set x2 [clock format $f2 -format {%Y-%m-%d %H:%M:%S %z} -timezone EST5EDT]
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set f1 [clock add $t 1 day \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set f2 [clock add $t 2 day \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set x2 [clock format $f2 -format {%Y-%m-%d %H:%M:%S %z} \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
list $x1 $x2
} {{2004-10-31 00:59:59 -0400} {2004-11-01 00:59:59 -0500}}
test clock-30.14 {clock add days, fall DST conversion, bad case} {
set t [clock scan {2004-10-30 01:30:00} -format {%Y-%m-%d %H:%M:%S} \
- -timezone EST5EDT]
- set f1 [clock add $t 1 day -timezone EST5EDT]
- set f2 [clock add $t 2 day -timezone EST5EDT]
- set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} -timezone EST5EDT]
- set x2 [clock format $f2 -format {%Y-%m-%d %H:%M:%S %z} -timezone EST5EDT]
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set f1 [clock add $t 1 day \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set f2 [clock add $t 2 day \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set x2 [clock format $f2 -format {%Y-%m-%d %H:%M:%S %z} \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
list $x1 $x2
} {{2004-10-31 01:30:00 -0400} {2004-11-01 01:30:00 -0500}}
test clock-30.15 {clock add days, fall DST conversion, after} {
set t [clock scan {2004-10-30 02:30:00} -format {%Y-%m-%d %H:%M:%S} \
- -timezone EST5EDT]
- set f1 [clock add $t 1 day -timezone EST5EDT]
- set f2 [clock add $t 2 day -timezone EST5EDT]
- set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} -timezone EST5EDT]
- set x2 [clock format $f2 -format {%Y-%m-%d %H:%M:%S %z} -timezone EST5EDT]
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set f1 [clock add $t 1 day \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set f2 [clock add $t 2 day \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set x2 [clock format $f2 -format {%Y-%m-%d %H:%M:%S %z} \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
list $x1 $x2
} {{2004-10-31 02:30:00 -0500} {2004-11-01 02:30:00 -0500}}
test clock-30.16 {clock add weeks} {
@@ -35119,16 +35141,19 @@ test clock-30.17 {clock add hours} {
test clock-30.18 {clock add hours at DST conversion} {
set t [clock scan {2004-04-04 01:00:00 -0500} \
-format {%Y-%m-%d %H:%M:%S %z} \
- -timezone EST5EDT]
- set f1 [clock add $t 1 hour -timezone EST5EDT]
- set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} -timezone EST5EDT]
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set f1 [clock add $t 1 hour -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
} {2004-04-04 03:00:00 -0400}
test clock-30.19 {clock add hours at DST conversion} {
set t [clock scan {2004-10-31 01:00:00 -0400} \
-format {%Y-%m-%d %H:%M:%S %z} \
- -timezone EST5EDT]
- set f1 [clock add $t 1 hour -timezone EST5EDT]
- set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} -timezone EST5EDT]
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set f1 [clock add $t 1 hour \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
} {2004-10-31 01:00:00 -0500}
test clock-30.20 {clock add minutes} {
set t [clock scan {2000-01-01 12:34:56} -format {%Y-%m-%d %H:%M:%S} \
@@ -35142,16 +35167,20 @@ test clock-30.20 {clock add minutes} {
test clock-30.21 {clock add minutes at DST conversion} {
set t [clock scan {2004-04-04 01:00:00 -0500} \
-format {%Y-%m-%d %H:%M:%S %z} \
- -timezone EST5EDT]
- set f1 [clock add $t 60 minutes -timezone EST5EDT]
- set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} -timezone EST5EDT]
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set f1 [clock add $t 60 minutes \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
} {2004-04-04 03:00:00 -0400}
test clock-30.22 {clock add minutes at DST conversion} {
set t [clock scan {2004-10-31 01:00:00 -0400} \
-format {%Y-%m-%d %H:%M:%S %z} \
- -timezone EST5EDT]
- set f1 [clock add $t 60 minutes -timezone EST5EDT]
- set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} -timezone EST5EDT]
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set f1 [clock add $t 60 minutes \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
} {2004-10-31 01:00:00 -0500}
test clock-30.23 {clock add seconds} {
set t [clock scan {2000-01-01 12:34:56} -format {%Y-%m-%d %H:%M:%S} \
@@ -35165,16 +35194,19 @@ test clock-30.23 {clock add seconds} {
test clock-30.24 {clock add seconds at DST conversion} {
set t [clock scan {2004-04-04 01:00:00 -0500} \
-format {%Y-%m-%d %H:%M:%S %z} \
- -timezone EST5EDT]
- set f1 [clock add $t 3600 seconds -timezone EST5EDT]
- set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} -timezone EST5EDT]
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set f1 [clock add $t 3600 seconds \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
} {2004-04-04 03:00:00 -0400}
test clock-30.25 {clock add seconds at DST conversion} {
set t [clock scan {2004-10-31 01:00:00 -0400} \
-format {%Y-%m-%d %H:%M:%S %z} \
- -timezone EST5EDT]
- set f1 [clock add $t 3600 seconds -timezone EST5EDT]
- set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} -timezone EST5EDT]
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set f1 [clock add $t 3600 seconds -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
+ set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} \
+ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00]
} {2004-10-31 01:00:00 -0500}
test clock-31.1 {system locale} \
@@ -36091,6 +36123,103 @@ test clock-55.10 {Common Era} {
-gmt 1 -format {%d %m %Y %EE} -locale en_US_roman
} -62135856000
+test clock-56.1 {use of zoneinfo, version 1} {*}{
+ -setup {
+ clock format [clock seconds]
+ set tzdir [makeDirectory zoneinfo]
+ set tzdir2 [makeDirectory Test $tzdir]
+ set tzfile [makeFile {} PhoenixOne $tzdir2]
+ set f [open $tzfile wb]
+ puts -nonewline $f [binary format c* {
+ 0x54 0x5a 0x69 0x66 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
+ 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x03
+ 0x00 0x00 0x00 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a
+ 0x00 0x00 0x00 0x03 0x00 0x00 0x00 0x0c 0x9e 0xa6 0x3a 0x90
+ 0x9f 0xbb 0x07 0x80 0xa0 0x86 0x1c 0x90 0xa1 0x9a 0xe9 0x80
+ 0xcb 0x89 0x0c 0x90 0xcf 0x17 0xdf 0x1c 0xcf 0x8f 0xe5 0xac
+ 0xd0 0x81 0x1a 0x1c 0xfa 0xf8 0x75 0x10 0xfb 0xe8 0x58 0x00
+ 0x00 0x01 0x00 0x01 0x02 0x01 0x02 0x01 0x00 0x01 0xff 0xff
+ 0xab 0xa0 0x01 0x00 0xff 0xff 0x9d 0x90 0x00 0x04 0xff 0xff
+ 0xab 0xa0 0x01 0x08 0x4d 0x44 0x54 0x00 0x4d 0x53 0x54 0x00
+ 0x4d 0x57 0x54 0x00 0x00 0x00 0x00 0x00 0x00 0x00
+ }]
+ close $f
+ set ::tcl::clock::ZoneinfoPaths \
+ [linsert $::tcl::clock::ZoneinfoPaths 0 $tzdir]
+ ::tcl::clock::ClearCaches
+ }
+ -cleanup {
+ set ::tcl::clock::ZoneinfoPaths \
+ [lrange $::tcl::clock::ZoneinfoPaths 1 end]
+ ::tcl::clock::ClearCaches
+ removeFile PhoenixOne $tzdir2
+ removeDirectory Test $tzdir
+ removeDirectory zoneinfo
+ }
+ -body {
+ clock format 1072940400 -timezone :Test/PhoenixOne \
+ -format {%Y-%m-%d %H:%M:%S %Z}
+ }
+ -result {2004-01-01 00:00:00 MST}
+}
+
+test clock-56.2 {use of zoneinfo, version 2} {*}{
+ -setup {
+ clock format [clock seconds]
+ set tzdir [makeDirectory zoneinfo]
+ set tzdir2 [makeDirectory Test $tzdir]
+ set tzfile [makeFile {} PhoenixTwo $tzdir2]
+ set f [open $tzfile wb]
+ puts -nonewline $f [binary format c* {
+ 0x54 0x5a 0x69 0x66 0x32 0x00 0x00 0x00 0x00 0x00 0x00 0x00
+ 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x03
+ 0x00 0x00 0x00 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a
+ 0x00 0x00 0x00 0x03 0x00 0x00 0x00 0x0c 0x9e 0xa6 0x3a 0x90
+ 0x9f 0xbb 0x07 0x80 0xa0 0x86 0x1c 0x90 0xa1 0x9a 0xe9 0x80
+ 0xcb 0x89 0x0c 0x90 0xcf 0x17 0xdf 0x1c 0xcf 0x8f 0xe5 0xac
+ 0xd0 0x81 0x1a 0x1c 0xfa 0xf8 0x75 0x10 0xfb 0xe8 0x58 0x00
+ 0x00 0x01 0x00 0x01 0x02 0x01 0x02 0x01 0x00 0x01 0xff 0xff
+ 0xab 0xa0 0x01 0x00 0xff 0xff 0x9d 0x90 0x00 0x04 0xff 0xff
+ 0xab 0xa0 0x01 0x08 0x4d 0x44 0x54 0x00 0x4d 0x53 0x54 0x00
+ 0x4d 0x57 0x54 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x54 0x5a
+ 0x69 0x66 0x32 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
+ 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x04 0x00 0x00
+ 0x00 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0b 0x00 0x00
+ 0x00 0x04 0x00 0x00 0x00 0x10 0xff 0xff 0xff 0xff 0x5e 0x04
+ 0x0c 0xb0 0xff 0xff 0xff 0xff 0x9e 0xa6 0x3a 0x90 0xff 0xff
+ 0xff 0xff 0x9f 0xbb 0x07 0x80 0xff 0xff 0xff 0xff 0xa0 0x86
+ 0x1c 0x90 0xff 0xff 0xff 0xff 0xa1 0x9a 0xe9 0x80 0xff 0xff
+ 0xff 0xff 0xcb 0x89 0x0c 0x90 0xff 0xff 0xff 0xff 0xcf 0x17
+ 0xdf 0x1c 0xff 0xff 0xff 0xff 0xcf 0x8f 0xe5 0xac 0xff 0xff
+ 0xff 0xff 0xd0 0x81 0x1a 0x1c 0xff 0xff 0xff 0xff 0xfa 0xf8
+ 0x75 0x10 0xff 0xff 0xff 0xff 0xfb 0xe8 0x58 0x00 0x02 0x01
+ 0x02 0x01 0x02 0x03 0x02 0x03 0x02 0x01 0x02 0xff 0xff 0x96
+ 0xee 0x00 0x00 0xff 0xff 0xab 0xa0 0x01 0x04 0xff 0xff 0x9d
+ 0x90 0x00 0x08 0xff 0xff 0xab 0xa0 0x01 0x0c 0x4c 0x4d 0x54
+ 0x00 0x4d 0x44 0x54 0x00 0x4d 0x53 0x54 0x00 0x4d 0x57 0x54
+ 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x4d 0x53
+ 0x54 0x37 0x0a
+ }]
+ close $f
+ set ::tcl::clock::ZoneinfoPaths \
+ [linsert $::tcl::clock::ZoneinfoPaths 0 $tzdir]
+ ::tcl::clock::ClearCaches
+ }
+ -cleanup {
+ set ::tcl::clock::ZoneinfoPaths \
+ [lrange $::tcl::clock::ZoneinfoPaths 1 end]
+ ::tcl::clock::ClearCaches
+ removeFile PhoenixTwo $tzdir2
+ removeDirectory Test $tzdir
+ removeDirectory zoneinfo
+ }
+ -body {
+ clock format 1072940400 -timezone :Test/PhoenixTwo \
+ -format {%Y-%m-%d %H:%M:%S %Z}
+ }
+ -result {2004-01-01 00:00:00 MST}
+}
+
# cleanup
namespace delete ::testClock