bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: parse-datetime.y - Military Timezones are inverted from the correct


From: Assaf Gordon
Subject: Re: parse-datetime.y - Military Timezones are inverted from the correct sense
Date: Fri, 9 Aug 2019 08:43:12 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

Hello,

On 2019-08-09 5:31 a.m., Neil Hoggarth wrote:
I have observed incorrect handling of "Military" timezones when
exercising the --date=... option of the GNU coreutils "date" utility.
I believe the underlying problem is with initialization of
"military_table[]" in the parse-datetime.y file of gnulib.
[...]
>
Utilities using parse-datetime routines interpret correctly interpret
"Z" as UTC, but all the letters the wrong way around: zone "A" should
be one hour ahead of UTC (Paris, France when not observing DST for
example), but parse-datetime has it one hour behind:


Thank you for the report.

For reference,
it seems this change happened 20 years less 20 days ago,
in commit c6cb26ec2993800dda1b95c213fc4539acd4fa51 from August 29, 1999:

https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=c6cb26ec2

This change rewrote the "lib/getdate.y" file (the precursor to lib/parse-datetime.y) from the public domain version into
a more GNU-like style.

It contained the following changes:
-----
-/* Military timezone table. */
-static TABLE const MilitaryTable[] = {
-    { "a",     tZONE,  HOUR (  1) },
-    { "b",     tZONE,  HOUR (  2) },
-    { "c",     tZONE,  HOUR (  3) },
-    { "d",     tZONE,  HOUR (  4) },
-    { "e",     tZONE,  HOUR (  5) },
[....]
+/* Military time zone table. */
+static table const military_table[] =
 {
+  { "A", tZONE,        -HOUR ( 1) },
+  { "B", tZONE,        -HOUR ( 2) },
+  { "C", tZONE,        -HOUR ( 3) },
+  { "D", tZONE,        -HOUR ( 4) },
+  { "E", tZONE,        -HOUR ( 5) },
-----

Since it was in 1999, it predates all "coreutils" versions
(they were separate sh-utils,text-utils,file-utils packages).

On GNU's ftp server ( https://ftp.gnu.org/old-gnu/sh-utils/ ),
the last available version of sh-utils (version 2.0) from
August 15, 1999 had the positive (A=1) military time zones.
There are mentions (on the website and in coreutils' NEWS file)
of later version sh-tuils-2.0.15 which likely had negative (A=-1)
military time zones.

The first public version of the unified coreutils-5.0 from 2003
already used the negative values.

-assaf








reply via email to

[Prev in Thread] Current Thread [Next in Thread]