From d1edd68524561d9f8c25de1d4a095eaf4a09f55a Mon Sep 17 00:00:00 2001 From: ericm Date: Mon, 28 Feb 2000 18:49:41 +0000 Subject: * tests/clock.test: Added test for ISO bases < 100000 * generic/tclDate.c: (generated on Solaris) * generic/tclGetDate.y: Changed condition for deciding if a number is an ISO 8601 base from number >= 100000 to numberOfDigits >= 6. Previously it would fail to recognize 000000 as an ISO base. --- ChangeLog | 16 ++++++++++++++++ generic/tclDate.c | 8 ++++++-- generic/tclGetDate.y | 8 ++++++-- tests/clock.test | 6 +++++- 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 36c1e3e..ec0894f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2000-02-28 Eric Melski + + * tests/clock.test: Added test for ISO bases < 100000 + + * generic/tclDate.c: (generated on Solaris) + * generic/tclGetDate.y: Changed condition for deciding if a number + is an ISO 8601 base from number >= 100000 to numberOfDigits >= 6. + Previously it would fail to recognize 000000 as an ISO base. + +2000-02-14 Eric Melski + + * unix/Makefile.in: Added rpm target to generate Tcl binary RPM. + + * unix/tcl.spec: RPM specification file for a Tcl binary RPM for + Linux. + 2000-02-10 Jeff Hobbs 8.3.0 RELEASE diff --git a/generic/tclDate.c b/generic/tclDate.c index 5e36665..02a82c7 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -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: tclDate.c,v 1.16 2000/02/09 03:56:24 ericm Exp $ + * RCS: @(#) $Id: tclDate.c,v 1.17 2000/02/28 18:49:42 ericm Exp $ */ #include "tclInt.h" @@ -765,12 +765,16 @@ TclDatelex() } if (isdigit(UCHAR(c = *TclDateInput))) { /* INTL: digit */ + /* convert the string into a number; count the number of digits */ + Count = 0; for (TclDatelval.Number = 0; isdigit(UCHAR(c = *TclDateInput++)); ) { /* INTL: digit */ TclDatelval.Number = 10 * TclDatelval.Number + c - '0'; + Count++; } TclDateInput--; - if (TclDatelval.Number >= 100000) { + /* A number with 6 or more digits is considered an ISO 8601 base */ + if (Count >= 6) { return tISOBASE; } else { return tUNUMBER; diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index c5347bb..f34cb9c 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.14 2000/02/09 03:56:24 ericm Exp $ + * RCS: @(#) $Id: tclGetDate.y,v 1.15 2000/02/28 18:49:42 ericm Exp $ */ %{ @@ -980,12 +980,16 @@ yylex() } if (isdigit(UCHAR(c = *yyInput))) { /* INTL: digit */ + /* convert the string into a number; count the number of digits */ + Count = 0; for (yylval.Number = 0; isdigit(UCHAR(c = *yyInput++)); ) { /* INTL: digit */ yylval.Number = 10 * yylval.Number + c - '0'; + Count++; } yyInput--; - if (yylval.Number >= 100000) { + /* A number with 6 or more digits is considered an ISO 8601 base */ + if (Count >= 6) { return tISOBASE; } else { return tUNUMBER; diff --git a/tests/clock.test b/tests/clock.test index e7c65b0..57e3921 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.10 2000/02/09 03:56:24 ericm Exp $ +# RCS: @(#) $Id: clock.test,v 1.11 2000/02/28 18:49:42 ericm Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -182,6 +182,10 @@ test clock-4.17 {clock scan, ISO 8601 point in time format} { set time [clock scan "19921023 235959"] clock format $time -format {%b %d, %Y %H:%M:%S} } "Oct 23, 1992 23:59:59" +test clock-4.18 {clock scan, ISO 8601 point in time format} { + set time [clock scan "19921023T000000"] + clock format $time -format {%b %d, %Y %H:%M:%S} +} "Oct 23, 1992 00:00:00" # CLOCK SCAN REAL TESTS test clock-4.18 {clock scan, number meridian} { -- cgit v0.12