# HG changeset patch # User Paul Eggert # Date 1113290571 0 # Node ID e6643f99cbc092da9001f5d2826769ea454b4ce0 # Parent f4436e62badb56ba5d9e91d3edd101bf8e8521d6 (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. diff --git a/lib/getdate.y b/lib/getdate.y --- a/lib/getdate.y +++ b/lib/getdate.y @@ -645,6 +645,17 @@ { 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 @@ 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 @@ { "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 @@ { 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;