diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2005-04-12 07:21:18 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2005-04-12 07:21:18 +0000 |
commit | 1d6ad9ddf2c263994a602bcfc010d5ef1eb740dd (patch) | |
tree | e277135966ca67830468a239e5fb2763f0732e78 /lib/getdate.y | |
parent | 21e982ed8130cb06bb5add2ec4c298a79560a70d (diff) | |
download | coreutils-1d6ad9ddf2c263994a602bcfc010d5ef1eb740dd.tar.xz |
(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.
Diffstat (limited to 'lib/getdate.y')
-rw-r--r-- | lib/getdate.y | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/lib/getdate.y b/lib/getdate.y index 387adce8e..4004ea923 100644 --- a/lib/getdate.y +++ b/lib/getdate.y @@ -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, char const *name) { 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; |