summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--generic/tclDate.c2
-rw-r--r--generic/tclGetDate.y4
-rw-r--r--tests/clock.test159
4 files changed, 172 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index d744970..ea3c72a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2004-03-10 Kevin B. Kenny <kennykb@acm.org>
+
+ * generic/tclGetDate.y (TclGetDate): Fix so that
+ [clock scan <timeOfDay> -gmt true] uses the GMT base date
+ instead of the local one. [Bug 913513]
+ * tests/clock.test: Added test cases for wrong ISO8601 week number
+ [Bug 500285] and wrong GMT base date [Bug 913513]. Several tests
+ still fail on Windows, and these are actual faults in [clock scan].
+ Fix is still pending.
+ * generic/tclDate.c: Regenerated.
+
2004-03-08 Vince Darley <vincentdarley@users.sourceforge.net>
* generic/tclFileName.c: Fix to 'glob -path' near the root
diff --git a/generic/tclDate.c b/generic/tclDate.c
index d6f8d45..3110f9e 100644
--- a/generic/tclDate.c
+++ b/generic/tclDate.c
@@ -927,7 +927,7 @@ TclGetDate(p, now, zone, timePtr)
TclDateInput = p;
/* now has to be cast to a time_t for 64bit compliance */
Start = now;
- tm = TclpGetDate((TclpTime_t) &Start, 0);
+ tm = TclpGetDate((TclpTime_t) &Start, (zone == -50000));
thisyear = tm->tm_year + TM_YEAR_BASE;
TclDateYear = thisyear;
TclDateMonth = tm->tm_mon + 1;
diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y
index 3a7d032..f7f1366 100644
--- a/generic/tclGetDate.y
+++ b/generic/tclGetDate.y
@@ -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: tclGetDate.y,v 1.19 2003/05/15 21:51:46 kennykb Exp $
+ * RCS: @(#) $Id: tclGetDate.y,v 1.20 2004/03/10 16:01:26 kennykb Exp $
*/
%{
@@ -1146,7 +1146,7 @@ TclGetDate(p, now, zone, timePtr)
yyInput = p;
/* now has to be cast to a time_t for 64bit compliance */
Start = now;
- tm = TclpGetDate((TclpTime_t) &Start, 0);
+ tm = TclpGetDate((TclpTime_t) &Start, (zone == -50000));
thisyear = tm->tm_year + TM_YEAR_BASE;
yyYear = thisyear;
yyMonth = tm->tm_mon + 1;
diff --git a/tests/clock.test b/tests/clock.test
index a78f58f..08818d7 100644
--- a/tests/clock.test
+++ b/tests/clock.test
@@ -10,7 +10,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.23 2003/04/12 19:08:55 kennykb Exp $
+# RCS: @(#) $Id: clock.test,v 1.24 2004/03/10 16:01:26 kennykb Exp $
set env(LC_TIME) POSIX
@@ -501,6 +501,163 @@ test clock-9.1 {%s gmt testing} {needPST} {
set c [expr {$b-$a}]
} {28800}
+test clock-10.1 {ISO week-based calendar} {
+ clock format 977702400 -format {%a %A %u %V %w} -gmt true; # 2000-12-25
+} {Mon Monday 1 52 1}
+test clock-10.2 {ISO week-based calendar} {
+ clock format 978220800 -format {%a %A %u %V %w} -gmt true; # 2000-12-31
+} {Sun Sunday 7 52 0}
+test clock-10.3 {ISO week-based calendar} {
+ clock format 978307200 -format {%a %A %u %V %w} -gmt true; # 2001-1-1
+} {Mon Monday 1 01 1}
+test clock-10.4 {ISO week-based calendar} {
+ clock format 978825600 -format {%a %A %u %V %w} -gmt true; # 2001-1-7
+} {Sun Sunday 7 01 0}
+test clock-10.5 {ISO week-based calendar} {
+ clock format 978912000 -format {%a %A %u %V %w} -gmt true; # 2001-1-8
+} {Mon Monday 1 02 1}
+test clock-10.6 {ISO week-based calendar} {
+ clock format 1009152000 -format {%a %A %u %V %w} -gmt true; # 2001-12-24
+} {Mon Monday 1 52 1}
+test clock-10.7 {ISO week-based calendar} {
+ clock format 1009670400 -format {%a %A %u %V %w} -gmt true; # 2001-12-30
+} {Sun Sunday 7 52 0}
+test clock-10.8 {ISO week-based calendar} {
+ clock format 1009756800 -format {%a %A %u %V %w} -gmt true; # 2001-12-31
+} {Mon Monday 1 01 1}
+test clock-10.9 {ISO week-based calendar} {
+ clock format 1009843200 -format {%a %A %u %V %w} -gmt true; # 2002-1-1
+} {Tue Tuesday 2 01 2}
+test clock-10.10 {ISO week-based calendar} {
+ clock format 1010275200 -format {%a %A %u %V %w} -gmt true; # 2002-1-6
+} {Sun Sunday 7 01 0}
+test clock-10.11 {ISO week-based calendar} {
+ clock format 1010361600 -format {%a %A %u %V %w} -gmt true; # 2002-1-7
+} {Mon Monday 1 02 1}
+test clock-10.12 {ISO week-based calendar} {
+ clock format 1040601600 -format {%a %A %u %V %w} -gmt true; # 2002-12-23
+} {Mon Monday 1 52 1}
+test clock-10.13 {ISO week-based calendar} {
+ clock format 1041120000 -format {%a %A %u %V %w} -gmt true; # 2002-12-29
+} {Sun Sunday 7 52 0}
+test clock-10.14 {ISO week-based calendar} {
+ clock format 1041206400 -format {%a %A %u %V %w} -gmt true; # 2002-12-30
+} {Mon Monday 1 01 1}
+test clock-10.15 {ISO week-based calendar} {
+ clock format 1041292800 -format {%a %A %u %V %w} -gmt true; # 2002-12-31
+} {Tue Tuesday 2 01 2}
+test clock-10.16 {ISO week-based calendar} {
+ clock format 1041379200 -format {%a %A %u %V %w} -gmt true; # 2003-1-1
+} {Wed Wednesday 3 01 3}
+test clock-10.17 {ISO week-based calendar} {
+ clock format 1041724800 -format {%a %A %u %V %w} -gmt true; # 2003-1-5
+} {Sun Sunday 7 01 0}
+test clock-10.18 {ISO week-based calendar} {
+ clock format 1041811200 -format {%a %A %u %V %w} -gmt true; # 2003-1-6
+} {Mon Monday 1 02 1}
+test clock-10.19 {ISO week-based calendar} {
+ clock format 1072051200 -format {%a %A %u %V %w} -gmt true; # 2003-12-22
+} {Mon Monday 1 52 1}
+test clock-10.20 {ISO week-based calendar} {
+ clock format 1072569600 -format {%a %A %u %V %w} -gmt true; # 2003-12-28
+} {Sun Sunday 7 52 0}
+test clock-10.21 {ISO week-based calendar} {
+ clock format 1072656000 -format {%a %A %u %V %w} -gmt true; # 2003-12-29
+} {Mon Monday 1 01 1}
+test clock-10.22 {ISO week-based calendar} {
+ clock format 1072828800 -format {%a %A %u %V %w} -gmt true; # 2003-12-31
+} {Wed Wednesday 3 01 3}
+test clock-10.23 {ISO week-based calendar} {
+ clock format 1072915200 -format {%a %A %u %V %w} -gmt true; # 2004-1-1
+} {Thu Thursday 4 01 4}
+test clock-10.24 {ISO week-based calendar} {
+ clock format 1073174400 -format {%a %A %u %V %w} -gmt true; # 2004-1-4
+} {Sun Sunday 7 01 0}
+test clock-10.25 {ISO week-based calendar} {
+ clock format 1073260800 -format {%a %A %u %V %w} -gmt true; # 2004-1-5
+} {Mon Monday 1 02 1}
+test clock-10.26 {ISO week-based calendar} {
+ clock format 1103500800 -format {%a %A %u %V %w} -gmt true; # 2004-12-20
+} {Mon Monday 1 52 1}
+test clock-10.27 {ISO week-based calendar} {
+ clock format 1104019200 -format {%a %A %u %V %w} -gmt true; # 2004-12-26
+} {Sun Sunday 7 52 0}
+test clock-10.28 {ISO week-based calendar} {
+ clock format 1104105600 -format {%a %A %u %V %w} -gmt true; # 2004-12-27
+} {Mon Monday 1 53 1}
+test clock-10.29 {ISO week-based calendar} {
+ clock format 1104451200 -format {%a %A %u %V %w} -gmt true; # 2004-12-31
+} {Fri Friday 5 53 5}
+test clock-10.30 {ISO week-based calendar} {
+ clock format 1104537600 -format {%a %A %u %V %w} -gmt true; # 2005-1-1
+} {Sat Saturday 6 53 6}
+test clock-10.31 {ISO week-based calendar} {
+ clock format 1104624000 -format {%a %A %u %V %w} -gmt true; # 2005-1-2
+} {Sun Sunday 7 53 0}
+test clock-10.32 {ISO week-based calendar} {
+ clock format 1104710400 -format {%a %A %u %V %w} -gmt true; # 2005-1-3
+} {Mon Monday 1 01 1}
+test clock-10.33 {ISO week-based calendar} {
+ clock format 1105228800 -format {%a %A %u %V %w} -gmt true; # 2005-1-9
+} {Sun Sunday 7 01 0}
+test clock-10.34 {ISO week-based calendar} {
+ clock format 1105315200 -format {%a %A %u %V %w} -gmt true; # 2005-1-10
+} {Mon Monday 1 02 1}
+test clock-10.35 {ISO week-based calendar} {
+ clock format 1135555200 -format {%a %A %u %V %w} -gmt true; # 2005-12-26
+} {Mon Monday 1 52 1}
+test clock-10.36 {ISO week-based calendar} {
+ clock format 1135987200 -format {%a %A %u %V %w} -gmt true; # 2005-12-31
+} {Sat Saturday 6 52 6}
+test clock-10.37 {ISO week-based calendar} {
+ clock format 1136073600 -format {%a %A %u %V %w} -gmt true; # 2006-1-1
+} {Sun Sunday 7 52 0}
+test clock-10.38 {ISO week-based calendar} {
+ clock format 1136160000 -format {%a %A %u %V %w} -gmt true; # 2006-1-2
+} {Mon Monday 1 01 1}
+test clock-10.39 {ISO week-based calendar} {
+ clock format 1136678400 -format {%a %A %u %V %w} -gmt true; # 2006-1-8
+} {Sun Sunday 7 01 0}
+test clock-10.40 {ISO week-based calendar} {
+ clock format 1136764800 -format {%a %A %u %V %w} -gmt true; # 2006-1-9
+} {Mon Monday 1 02 1}
+test clock-10.41 {ISO week-based calendar} {
+ clock format 1261353600 -format {%a %A %u %V %w} -gmt true; # 2009-12-21
+} {Mon Monday 1 52 1}
+test clock-10.42 {ISO week-based calendar} {
+ clock format 1261872000 -format {%a %A %u %V %w} -gmt true; # 2009-12-27
+} {Sun Sunday 7 52 0}
+test clock-10.43 {ISO week-based calendar} {
+ clock format 1261958400 -format {%a %A %u %V %w} -gmt true; # 2009-12-28
+} {Mon Monday 1 53 1}
+test clock-10.44 {ISO week-based calendar} {
+ clock format 1262217600 -format {%a %A %u %V %w} -gmt true; # 2009-12-31
+} {Thu Thursday 4 53 4}
+test clock-10.45 {ISO week-based calendar} {
+ clock format 1262304000 -format {%a %A %u %V %w} -gmt true; # 2010-1-1
+} {Fri Friday 5 53 5}
+test clock-10.46 {ISO week-based calendar} {
+ clock format 1262476800 -format {%a %A %u %V %w} -gmt true; # 2010-1-3
+} {Sun Sunday 7 53 0}
+test clock-10.47 {ISO week-based calendar} {
+ clock format 1262563200 -format {%a %A %u %V %w} -gmt true; # 2010-1-4
+} {Mon Monday 1 01 1}
+test clock-10.48 {ISO week-based calendar} {
+ clock format 1263081600 -format {%a %A %u %V %w} -gmt true; # 2010-1-10
+} {Sun Sunday 7 01 0}
+test clock-10.49 {ISO week-based calendar} {
+ clock format 1263168000 -format {%a %A %u %V %w} -gmt true; # 2010-1-11
+} {Mon Monday 1 02 1}
+
+test clock-11.1 {scan of time alone in GMT assumes correct date} {
+ set base [clock scan 20040309T000001 -gmt true]
+ clock scan "1600" -gmt true -base $base
+} 1078848000
+test clock-11.2 {scan of time alone in GMT assumes correct date} {
+ set base [clock scan 20040309T235959 -gmt true]
+ clock scan "1600" -gmt true -base $base
+} 1078848000
+
# cleanup
::tcltest::cleanupTests
return