X-Git-Url: https://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fparse-datetime.y;h=01d71051c40fa73a39b7ae73a68e04ff5705689c;hb=ba7b7388f820b620ad4f92d263f7037dd7c89bfc;hp=33ef01a3474be6084a1bff2c9389055e53d8234e;hpb=f02585c1b0257f35aab61aae924f3f91ff7439e0;p=gnulib.git diff --git a/lib/parse-datetime.y b/lib/parse-datetime.y index 33ef01a34..01d71051c 100644 --- a/lib/parse-datetime.y +++ b/lib/parse-datetime.y @@ -1,7 +1,7 @@ %{ /* 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 @@ -82,7 +82,7 @@ - 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 @@ -296,7 +296,8 @@ set_hhmmss (parser_control *pc, long int hour, long int minutes, relative_time rel; } -%token tAGO tDST +%token tAGO +%token tDST %token tYEAR_UNIT tMONTH_UNIT tHOUR_UNIT tMINUTE_UNIT tSEC_UNIT %token tDAY_UNIT tDAY_SHIFT @@ -544,7 +545,7 @@ iso_8601_date: rel: relunit tAGO - { apply_relative_time (pc, $1, -1); } + { apply_relative_time (pc, $1, $2); } | relunit { apply_relative_time (pc, $1, 1); } | dayshift @@ -733,7 +734,8 @@ static table const relative_time_table[] = { "TENTH", tORDINAL, 10 }, { "ELEVENTH", tORDINAL, 11 }, { "TWELFTH", tORDINAL, 12 }, - { "AGO", tAGO, 1 }, + { "AGO", tAGO, -1 }, + { "HENCE", tAGO, 1 }, { NULL, 0, 0 } }; @@ -752,7 +754,7 @@ static table const universal_time_zone_table[] = 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 */ @@ -903,7 +905,7 @@ to_year (textint textyear) return year; } -static table const * +static table const * _GL_ATTRIBUTE_PURE lookup_zone (parser_control const *pc, char const *name) { table const *tp;