[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gnulib] problem with getdate
From: |
Paul Eggert |
Subject: |
Re: [bug-gnulib] problem with getdate |
Date: |
Tue, 12 Apr 2005 00:24:35 -0700 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux) |
Derek Price <address@hidden> writes:
> If I pass these times in as "EDT" (Eastern Daylight Time), then they
> work. Ian mentioned doing something similar with "BST" (British
> Summer Time) in a separate email. Is this an intentional failure?
No, it's not. I installed this fix into gnulib. Thanks for reporting
it.
2005-04-12 Paul Eggert <address@hidden>
* getdate.y (universal_time_zone_table): New constant.
(time_zone_table): Remove GMT, UT, UTC entries; they're now in
universal_time_zone_table.
(lookup_zone): Prefer universal_time_zone_table to
local_time_zone_table, so that "GMT" time stamps are allowed in
London during the summer. Problem reported by Ian Abbott.
--- getdate.y 4 Apr 2005 19:51:49 -0000 1.96
+++ getdate.y 12 Apr 2005 07:21:18 -0000 1.97
@@ -645,6 +645,17 @@ static table const relative_time_table[]
{ NULL, 0, 0 }
};
+/* The universal time zone table. These labels can be used even for
+ time stamps that would not otherwise be valid, e.g., GMT time
+ stamps in London during summer. */
+static table const universal_time_zone_table[] =
+{
+ { "GMT", tZONE, HOUR ( 0) }, /* Greenwich Mean */
+ { "UT", tZONE, HOUR ( 0) }, /* Universal (Coordinated) */
+ { "UTC", tZONE, HOUR ( 0) },
+ { NULL, 0, 0 }
+};
+
/* The time zone table. This table is necessarily incomplete, as time
zone abbreviations are ambiguous; e.g. Australians interpret "EST"
as Eastern time in Australia, not as US Eastern Standard Time.
@@ -652,9 +663,6 @@ static table const relative_time_table[]
abbreviations; use numeric abbreviations like `-0500' instead. */
static table const time_zone_table[] =
{
- { "GMT", tZONE, HOUR ( 0) }, /* Greenwich Mean */
- { "UT", tZONE, HOUR ( 0) }, /* Universal (Coordinated) */
- { "UTC", tZONE, HOUR ( 0) },
{ "WET", tZONE, HOUR ( 0) }, /* Western European */
{ "WEST", tDAYZONE, HOUR ( 0) }, /* Western European Summer */
{ "BST", tDAYZONE, HOUR ( 0) }, /* British Summer */
@@ -702,7 +710,7 @@ static table const time_zone_table[] =
{ "GST", tZONE, HOUR (10) }, /* Guam Standard */
{ "NZST", tZONE, HOUR (12) }, /* New Zealand Standard */
{ "NZDT", tDAYZONE, HOUR (12) }, /* New Zealand Daylight */
- { NULL, 0, 0 }
+ { NULL, 0, 0 }
};
/* Military time zone table. */
@@ -787,7 +795,12 @@ lookup_zone (parser_control const *pc, c
{
table const *tp;
- /* Try local zone abbreviations first; they're more likely to be right. */
+ for (tp = universal_time_zone_table; tp->name; tp++)
+ if (strcmp (name, tp->name) == 0)
+ return tp;
+
+ /* Try local zone abbreviations before those in time_zone_table, as
+ the local ones are more likely to be right. */
for (tp = pc->local_time_zone_table; tp->name; tp++)
if (strcmp (name, tp->name) == 0)
return tp;