%{
/* Parse a string into an internal time stamp.
- Copyright (C) 1999-2000, 2002-2011 Free Software Foundation, Inc.
+ Copyright (C) 1999-2000, 2002-2012 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- It's typically faster.
POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to
isdigit unless it's important to use the locale's definition
- of `digit' even when the host does not conform to POSIX. */
+ of "digit" even when the host does not conform to POSIX. */
#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
/* Shift A right by B bits portably, by dividing A by 2**B and
size_t times_seen;
size_t zones_seen;
- /* Table of local time zone abbrevations, terminated by a null entry. */
+ /* Table of local time zone abbreviations, terminated by a null entry. */
table local_time_zone_table[3];
} parser_control;
relative_time rel;
}
-%token tAGO tDST
+%token <intval> tAGO
+%token tDST
%token tYEAR_UNIT tMONTH_UNIT tHOUR_UNIT tMINUTE_UNIT tSEC_UNIT
%token <intval> tDAY_UNIT tDAY_SHIFT
rel:
relunit tAGO
- { apply_relative_time (pc, $1, -1); }
+ { apply_relative_time (pc, $1, $2); }
| relunit
{ apply_relative_time (pc, $1, 1); }
| dayshift
{ "TENTH", tORDINAL, 10 },
{ "ELEVENTH", tORDINAL, 11 },
{ "TWELFTH", tORDINAL, 12 },
- { "AGO", tAGO, 1 },
+ { "AGO", tAGO, -1 },
+ { "HENCE", tAGO, 1 },
{ NULL, 0, 0 }
};
zone abbreviations are ambiguous; e.g. Australians interpret "EST"
as Eastern time in Australia, not as US Eastern Standard Time.
You cannot rely on parse_datetime to handle arbitrary time zone
- abbreviations; use numeric abbreviations like `-0500' instead. */
+ abbreviations; use numeric abbreviations like "-0500" instead. */
static table const time_zone_table[] =
{
{ "WET", tZONE, HOUR ( 0) }, /* Western European */
return year;
}
-static table const *
+static table const * _GL_ATTRIBUTE_PURE
lookup_zone (parser_control const *pc, char const *name)
{
table const *tp;
&& ! strcmp (pc.local_time_zone_table[0].name,
pc.local_time_zone_table[1].name))
{
- /* This locale uses the same abbrevation for standard and
+ /* This locale uses the same abbreviation for standard and
daylight times. So if we see that abbreviation, we don't
know whether it's daylight time. */
pc.local_time_zone_table[0].value = -1;