From 97d7bdb53a0311ef3da99b07b875611f1f2e6394 Mon Sep 17 00:00:00 2001 From: Kevin B Kenny Date: Fri, 20 Apr 2007 04:11:22 +0000 Subject: Fixed a buglet in recognizing time zone SIERRA --- generic/tclDate.c | 2 +- generic/tclGetDate.y | 4 ++-- tests/clock.test | 10 +++------- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/generic/tclDate.c b/generic/tclDate.c index bfd4ccf..4c914fc 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -2204,7 +2204,7 @@ LookupWord( */ i = strlen(buff) - 1; - if (buff[i] == 's') { + if (i > 0 && buff[i] == 's') { buff[i] = '\0'; for (tp = UnitsTable; tp->name; tp++) { if (strcmp(buff, tp->name) == 0) { diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index f7203a3..89fa14d 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -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: tclGetDate.y,v 1.33 2007/04/20 03:50:21 kennykb Exp $ + * RCS: @(#) $Id: tclGetDate.y,v 1.34 2007/04/20 04:11:22 kennykb Exp $ */ %{ @@ -774,7 +774,7 @@ LookupWord( */ i = strlen(buff) - 1; - if (buff[i] == 's') { + if (i > 0 && buff[i] == 's') { buff[i] = '\0'; for (tp = UnitsTable; tp->name; tp++) { if (strcmp(buff, tp->name) == 0) { diff --git a/tests/clock.test b/tests/clock.test index 35af1f0..4fe33c7 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.77 2007/04/20 03:50:21 kennykb Exp $ +# RCS: @(#) $Id: clock.test,v 1.78 2007/04/20 04:11:22 kennykb Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -36541,12 +36541,8 @@ test clock-59.1 {military time zones} { if {$ms1 != $base + 3600 * $hour} { lappend trouble [list mzone $mzone ms1 is $ms1] } - # S means 'seconds' and therefore isn't parsed as a time zone. - # Yet another ambiguity in the free-form scanner! - if {$mzone ne "S"} { - if {$ms2 != $base + 3600 * $hour} { - lappend trouble [list mzone $mzone ms2 is $ms2] - } + if {$ms2 != $base + 3600 * $hour} { + lappend trouble [list mzone $mzone ms2 is $ms2] } incr hour } -- cgit v0.12