diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | generic/tclDate.c | 50 | ||||
-rw-r--r-- | generic/tclGetDate.y | 52 | ||||
-rw-r--r-- | tests/clock.test | 40 |
4 files changed, 96 insertions, 53 deletions
@@ -16,10 +16,15 @@ user 'nyademo' for pointing this out and developing a fix. * generic/tclPathObj.c: Corrected a 'const'ness fault that caused bitter complaints from MSVC. - * tests/clock.test (clock-40.1, clock-58.1): Corrected a + * tests/clock.test (clock-40.1, clock-58.1, clock-59.1): Corrected a test case that depended on ":localtime" being able to handle dates prior to the Posix epoch, [Bug 1618445] Added a test case for the dates of the Japanese emperors. [Bug 1637471] + Added a regression test for military time zone input conversion. + [Bug 1586828]. + * generic/tclGetDate.y (MilitaryTable): Fixed an ancient bug where + the military NZA time zones had the signs reversed [Bug 1586828]. + * generic/tclDate.c: Regenerated. 2007-04-19 Donal K. Fellows <donal.k.fellows@manchester.ac.uk> diff --git a/generic/tclDate.c b/generic/tclDate.c index cc1a30b..bfd4ccf 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -2068,31 +2068,31 @@ static TABLE TimezoneTable[] = { */ static TABLE MilitaryTable[] = { - { "a", tZONE, HOUR( 1) }, - { "b", tZONE, HOUR( 2) }, - { "c", tZONE, HOUR( 3) }, - { "d", tZONE, HOUR( 4) }, - { "e", tZONE, HOUR( 5) }, - { "f", tZONE, HOUR( 6) }, - { "g", tZONE, HOUR( 7) }, - { "h", tZONE, HOUR( 8) }, - { "i", tZONE, HOUR( 9) }, - { "k", tZONE, HOUR( 10) }, - { "l", tZONE, HOUR( 11) }, - { "m", tZONE, HOUR( 12) }, - { "n", tZONE, HOUR(- 1) }, - { "o", tZONE, HOUR(- 2) }, - { "p", tZONE, HOUR(- 3) }, - { "q", tZONE, HOUR(- 4) }, - { "r", tZONE, HOUR(- 5) }, - { "s", tZONE, HOUR(- 6) }, - { "t", tZONE, HOUR(- 7) }, - { "u", tZONE, HOUR(- 8) }, - { "v", tZONE, HOUR(- 9) }, - { "w", tZONE, HOUR(-10) }, - { "x", tZONE, HOUR(-11) }, - { "y", tZONE, HOUR(-12) }, - { "z", tZONE, HOUR( 0) }, + { "a", tZONE, -HOUR( 1) }, + { "b", tZONE, -HOUR( 2) }, + { "c", tZONE, -HOUR( 3) }, + { "d", tZONE, -HOUR( 4) }, + { "e", tZONE, -HOUR( 5) }, + { "f", tZONE, -HOUR( 6) }, + { "g", tZONE, -HOUR( 7) }, + { "h", tZONE, -HOUR( 8) }, + { "i", tZONE, -HOUR( 9) }, + { "k", tZONE, -HOUR(10) }, + { "l", tZONE, -HOUR(11) }, + { "m", tZONE, -HOUR(12) }, + { "n", tZONE, HOUR( 1) }, + { "o", tZONE, HOUR( 2) }, + { "p", tZONE, HOUR( 3) }, + { "q", tZONE, HOUR( 4) }, + { "r", tZONE, HOUR( 5) }, + { "s", tZONE, HOUR( 6) }, + { "t", tZONE, HOUR( 7) }, + { "u", tZONE, HOUR( 8) }, + { "v", tZONE, HOUR( 9) }, + { "w", tZONE, HOUR( 10) }, + { "x", tZONE, HOUR( 11) }, + { "y", tZONE, HOUR( 12) }, + { "z", tZONE, HOUR( 0) }, { NULL } }; diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index dba4a81..f7203a3 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.32 2007/03/20 16:19:26 dkf Exp $ + * RCS: @(#) $Id: tclGetDate.y,v 1.33 2007/04/20 03:50:21 kennykb Exp $ */ %{ @@ -638,31 +638,31 @@ static TABLE TimezoneTable[] = { */ static TABLE MilitaryTable[] = { - { "a", tZONE, HOUR( 1) }, - { "b", tZONE, HOUR( 2) }, - { "c", tZONE, HOUR( 3) }, - { "d", tZONE, HOUR( 4) }, - { "e", tZONE, HOUR( 5) }, - { "f", tZONE, HOUR( 6) }, - { "g", tZONE, HOUR( 7) }, - { "h", tZONE, HOUR( 8) }, - { "i", tZONE, HOUR( 9) }, - { "k", tZONE, HOUR( 10) }, - { "l", tZONE, HOUR( 11) }, - { "m", tZONE, HOUR( 12) }, - { "n", tZONE, HOUR(- 1) }, - { "o", tZONE, HOUR(- 2) }, - { "p", tZONE, HOUR(- 3) }, - { "q", tZONE, HOUR(- 4) }, - { "r", tZONE, HOUR(- 5) }, - { "s", tZONE, HOUR(- 6) }, - { "t", tZONE, HOUR(- 7) }, - { "u", tZONE, HOUR(- 8) }, - { "v", tZONE, HOUR(- 9) }, - { "w", tZONE, HOUR(-10) }, - { "x", tZONE, HOUR(-11) }, - { "y", tZONE, HOUR(-12) }, - { "z", tZONE, HOUR( 0) }, + { "a", tZONE, -HOUR( 1) }, + { "b", tZONE, -HOUR( 2) }, + { "c", tZONE, -HOUR( 3) }, + { "d", tZONE, -HOUR( 4) }, + { "e", tZONE, -HOUR( 5) }, + { "f", tZONE, -HOUR( 6) }, + { "g", tZONE, -HOUR( 7) }, + { "h", tZONE, -HOUR( 8) }, + { "i", tZONE, -HOUR( 9) }, + { "k", tZONE, -HOUR(10) }, + { "l", tZONE, -HOUR(11) }, + { "m", tZONE, -HOUR(12) }, + { "n", tZONE, HOUR( 1) }, + { "o", tZONE, HOUR( 2) }, + { "p", tZONE, HOUR( 3) }, + { "q", tZONE, HOUR( 4) }, + { "r", tZONE, HOUR( 5) }, + { "s", tZONE, HOUR( 6) }, + { "t", tZONE, HOUR( 7) }, + { "u", tZONE, HOUR( 8) }, + { "v", tZONE, HOUR( 9) }, + { "w", tZONE, HOUR( 10) }, + { "x", tZONE, HOUR( 11) }, + { "y", tZONE, HOUR( 12) }, + { "z", tZONE, HOUR( 0) }, { NULL } }; diff --git a/tests/clock.test b/tests/clock.test index 0aa65b6..35af1f0 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.76 2007/04/20 02:46:32 kennykb Exp $ +# RCS: @(#) $Id: clock.test,v 1.77 2007/04/20 03:50:21 kennykb Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -36519,6 +36519,44 @@ test clock-58.1 {clock l10n - Japanese localisation} {*}{ -result {} } +test clock-59.1 {military time zones} { + set hour 0 + set base [clock scan "20000101 000000" -format "%Y%m%d %H%M%S" -gmt 1] + set trouble {} + foreach {pzone mzone} { + Z Z A N B O C P D Q E R F S G T H U I V K W L X M Y + } { + catch {clock scan "20000101 000000 $pzone" \ + -format "%Y%m%d %H%M%S %Z"} ps1 + catch {clock scan "20000101 000000 $pzone"} ps2 + catch {clock scan "20000101 000000 $mzone" \ + -format "%Y%m%d %H%M%S %Z"} ms1 + catch {clock scan "20000101 000000 $mzone"} ms2 + if {$ps1 != $base - 3600 * $hour} { + lappend trouble [list pzone $pzone hour $hour ps1 is $ps1] + } + if {$ps2 != $base - 3600 * $hour} { + lappend trouble [list pzone $pzone ps2 is $ps2] + } + 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] + } + } + incr hour + } + join $trouble \n +} {} + + + + + # cleanup namespace delete ::testClock |