summaryrefslogtreecommitdiff
path: root/lib/getdate.y
AgeCommit message (Collapse)Author
2004-11-16(tORDINAL): New token.Paul Eggert
(day, relunit): Allow it for relative times. (relative_time_table): Use tORDINAL for ordinals.
2004-11-11Sync from gnulib.Paul Eggert
2004-11-03remove trailing blanksJim Meyering
2004-11-03Sync from gnulib.Paul Eggert
2004-10-29Sync from gnulib.Paul Eggert
2004-10-04Sync from gnulib, to remove dependencies of other modules on unlocked-io.Paul Eggert
2004-08-02(lookup_word): Rewrite to avoid cast.Paul Eggert
2004-06-06Update from gnulib.Jim Meyering
2004-03-17Include "getdate.h" first, as we can nowJim Meyering
assume C89 and don't need to worry about 'const'. Similarly, include "unlocked-io.h" near start, not in middle. Include <limits.h>. (textint.value): Use long int rather than int. (textint.digits): Use size_t rather than int. (BILLION, LOG10_BILLION): New constants. (parser_control): New member rel_ns. Members day_ordinal, time_zone, month, day, hour, minutes, rel_year, rel_month, rel_day, rel_hour, rel_minutes, rel_seconds are now long int, not int. Member seconds is now struct timespec, not int. New member timespec_seen. Members dates_seen, days_seen, local_zones_seen, rels_seen, times_seen, zones_seen are now size_t, not int. (%union.intval): Now long int, not int. New member timespec. (tSDECIMAL_NUMBER, tUDECIMAL_NUMBER): New tokens. (seconds, signed_seconds, unsigned_seconds): New nonterminals. (spec): Now is a timespec or an item list. (timespec, items): New nonterminals. (time, rel, relunit, number, get_date): Add support for fractional seconds. (time): Fix bug: seconds weren't cleared in "00:00 +0000" syntax. (gmtime, localtime, mktime): Remove decls; not needed with C89. (to_hour): First arg is now long int, not int. (to_year): Returns long int, not int. Don't treat year -70 like 70. (tm_diff): Returns long int, not int. (lookup_word): Use bool instead of int when appropriate. (yylex): Use size_t for count, not int. Detect overflow when parsing large integer constants. Add support for fractions. (get_date): Make pointers 'const' if possible. Use more-portable code to detect integer overflow. (main) [TEST]: Adjust to above changes. Test for localtime failure. Don't use ctime; it's not reliable if the year has >4 digits.
2004-03-15`date --date="21:04 +0100" +%S' would print the seconds valueJim Meyering
from the current time, rather than `00'. For a date string like `10:23 +0100', set the number of seconds to zero. Reported by Marc Haber.
2003-09-10Include <stdlib.h>, <string.h> unconditionally.Jim Meyering
2003-09-03(relative_time_table): Use tDAY_UNIT for "tomorrow",Jim Meyering
"yesterday", "today", and "now" rather than tMINUTE_UNIT. Of course with correspondingly smaller numbers for tomorrow and yesterday. From Tadayoshi Funaba. Originally installed into sh-utils on 1999-08-07, but the patch was mistakenly reverted by the next change to that shared file (but this time in fileutils) on 1999-08-29.
2003-06-10Also accept dates of the form May-23-2003.Jim Meyering
2003-06-07Include alloca.h unconditionally.Jim Meyering
2003-01-06(get_date): Test HAVE_STRUCT_TM_TM_ZONE, not HAVE_TM_ZONE.Jim Meyering
2002-01-16add 2002 to Copyright lineJim Meyering
2002-01-16(ISDIGIT): Comment fix.Jim Meyering
Add three semicolons, each just before a closing brace. Bison (as of version 1.31) no longer papers over that mistake.
2001-11-17Include unlocked-io.h.Jim Meyering
2001-04-08that's necessary when the offset spans a DST transition.Jim Meyering
2000-06-15(get_date): Apply relative times after time zone indicator, not before.Jim Meyering
2000-02-22Handle two-digit years with leading zeros correctly.Jim Meyering
(textint): New typedef. (parser_control): Member year changed from int to textint. All uses changed. (YYSTYPE): Removed; replaced by %union with int and textint members. (tDAY, tDAY_UNIT, tDAYZONE, tHOUR_UNIT, tID, tLOCAL_ZONE, tMERIDIAN, tMINUTE_UNIT, tMONTH, tMONTH_UNIT tSEC_UNIT, tSNUMBER, tUNUMBER, tYEAR_UNIT, tZONE, o_merid): Now of type <intval>. (tSNUMBER, tUNUMBER): Now of type <textintval>. (date, number, to_year): Use width of number in digits, not its value, to determine whether it's a 2-digit year, or a 2-digit time. (yylex): Store number of digits of numeric tokens. Reported by John Kendall. (parser_control): Changed from struct parser_control to typedef (for consistency). All uses changed. (tID): Removed; not used. (yylex): Return '?' for unknown identifiers, rather than (unused) tID.
2000-01-12Update copyright notice.Jim Meyering
2000-01-06Sync tm_diff with the GNU C Library.Jim Meyering
(TM_YEAR_BASE): Renamed from TM_YEAR_ORIGIN. All uses changed. (tm_diff): Renamed from difftm. All uses changed. Replace body with that taken from GNU C Library 2.1.3pre1. (get_date): Prefer tm_gmtoff to tm_diff if available.
1999-12-22rewrite expression (equivalently) at request of Paul EggertJim Meyering
1999-12-22(get_date): Fix typo in time_t overflow test.Jim Meyering
From Michael Stone.
1999-10-31update a comment from alpha.gnu.org:/home/gd/gnu/lib/getdate.yJim Meyering
1999-10-04(__attribute__): Define to empty if GCC claims toJim Meyering
be before 2.8; this is needed for OPENStep 4.2 cc. Also, define to empty if strict ANSI.
1999-08-29(relative_time_table): Change `type' of `THIS' fromJim Meyering
tMINUTE_UNIT to tUNUMBER. From Urs Thuermann.
1999-08-29(get_date): Rename latter local `tm' to probe_tm.Jim Meyering
1999-08-29(get_date): Rename outermost local `probe' to `quarter'.Jim Meyering
1999-08-29Add copyright notice.Jim Meyering
(number): Handle `Nov 11 1996' example; see Risks Digest 20.55 http://catless.ncl.ac.uk/Risks/20.55.html#subj18 (1999-08-27) (<stdio.h>): Include only if testing. (ISUPPER): Remove. (ISLOWER, PC): New macros. (<string.h>): Include if HAVE_STRING_H, not USG. (bcopy): Remove. (yymaxdepth, ..., yycheck): Don't bother to redefine, since we assume bison. (EPOCH_YEAR): Renamed from EPOCH. (table): Renamed from TABLE. (meridian): Now an anonymous enum. (struct parser_control): New type. (YYLEX_PARAM, YYPARSE_PARAM, YYSTYPE): New macros. (yyInput, ..., yyRelYear): Migrated into struct parser_control. (%pure_parser): Added, so that the parser is pure. (%union): Removed; the type is now just plain int. All %type directives removed. (tLOCAL_ZONE): New %token. (month_day_table): Renamed from MonthDayTable. (gmtime, localtime, mktime, time): Declare only if not defined. (meridian_table): New table. (dst_table): New table. (units_table): renamed from UnitsTable. (relative_time_table): Renamed from OtherTable. (time_zone_table): Renamed from TimezoneTable. Modernized data. (military_table): Renamed from MilitaryTable. (to_hour): Renamed from ToHour. (to_year): Renamed from ToYear. (lookup_zone): New function. (LookupWord): Renamed from lookup_word. Use lookup_zone for time zones. (yylex): Now reentrant. All callers changed. (get_date): Add support for local time zone abbreviations. Make it reentrant.
1999-08-07(OtherTable[]): Use tDAY_UNIT for `tomorrow,'Jim Meyering
`yesterday,' `today,' and `now' rather than tMINUTE_UNIT. Of course with correspondingly smaller numbers for tomorrow and yesterday. This change does not change the way the code works, since the grammar rules for the two symbols are analogous.
1999-05-20add the comment to go with last changeJim Meyering
1999-05-20(get_date): Let mktime deduce tm_isdst if weJim Meyering
have an absolute timestamp, or if the relative timestamp mentions days, months, or years.
1999-04-18<stdlib.h>: Include if HAVE_STDLIB_H, since bison 1.27 invokes "free".Jim Meyering
(LookupWord, yylex): Don't pass negative char to ctype macros.
1999-04-07(difftm): Protoize.Jim Meyering
1999-03-28(get_date): Reuse tm_isdst of first localtimeJim Meyering
call; this is an improvement on a bug fix suggested by martin@dresden.nacamar.de. Do not assume that localtime and gmtime return non-null. From Paul Eggert.
1999-02-19<alloca.h>: Include if HAVE_ALLOCA_H, not FORCE_ALLOCA_H.Jim Meyering
The FORCE_ALLOCA_H was a relic of the bad old pre-autoconf Emacs days.
1998-12-31Fix warnings from gcc -W -WallJim Meyering
(__attribute__): Define. (ATTRIBUTE_UNUSED): Define. (yyerror): Mark parameter as unused with ATTRIBUTE_UNUSED. (MonthDayTable): Add initializers for last entry. (UnitsTable): Likewise. (OtherTable): Likewise. (MilitaryTable): Likewise.
1998-03-14s/get-date.h/getdate.h/Jim Meyering
1998-02-20s/getdate.h/get-date.h/Jim Meyering
1998-01-06Add %expect directive.Jim Meyering
Move inclusion of getdate.h and dependent extern declarations down so getdate.h's prototype follows the sometimes-enabled definition of `const' to nothing. Otherwise, the prototype wouldn't match the definition because of the defined-away `const'. (get_date): ANSI-fy definition. From Kaveh Ghazi.
1997-06-01(OtherTable): Interpret `next' as 1 (not 2) units.Jim Meyering
Patch from Richard Sharman <rsharman@magmacom.com>.
1997-04-10s/;/. in comment to placate francoisJim Meyering
1997-02-27(tYEAR_UNIT): Increase yyRelYear by $1, not just by 1.Jim Meyering
From Andreas Schwab.
1997-02-22(tMONTH_UNIT): Increase yyRelMonth by $1, not just by 1.Jim Meyering
(tDAY_UNIT): Likewise for yyRelDay. (tHOUR_UNIT): Likewise for yyRelHour. (tMINUTE_UNIT): Likewise for yyRelMinutes. (tSEC_UNIT): Likewise for yyRelSeconds.
1997-01-18Indent with GNU indent.Jim Meyering
1997-01-18Indent 2 more cpp-directives to reflect nesting.Jim Meyering
1997-01-18(get_date): Change prototype to reflect const'ness of parameters.Jim Meyering
Indent cpp-directives to reflect nesting.
1997-01-181997-01-06 Paul Eggert <eggert@twinsun.com>Jim Meyering
* getdate.y: Rewrite to use mktime. <sys/timeb.h>: Don't include. (mktime): Declare. (struct timeb, timezone, DOOMSDAY, SECSPERDAY, DSTMODE, yyDSTmode, ToSeconds, Convert, DSTcorrect, RelativeDate, RelativeMonth): Remove. (ToHour): New function (part of the old ToSeconds fn). (ToYear): New function (part of the old Convert fn). (TABLE.value, yyDayOrdinal, yyDayNumber, yyTimezone, yyDay, yyHour, yyMinutes, yyMonth, yySeconds, yyYear, yyRelMonth, yyRelSeconds, Number): Now int instead of time_t. (HOUR): Don't cast to time_t. (tDAY_UNIT, tHOUR_UNIT, tYEAR_UNIT): New %tokens. (UnitsTable): Use new units that are closer to the keywords. (yyRelDay, yyRelHour, yyRelMinutes, yyRelYear): New variables. (rel, relunit, get_date): Add support for them. (time): Fix timezone calculations for negative half-hour offsets when integer division truncates towards minus infinity. (zone): Incorporiate DST calculation directly. (get_date): 2nd arg is now time_t *, not struct timeb *. Use mktime to do most of the work, instead of computing it ourselves. Guard against falsely reporting errors near the time_t boundaries when parsing times in other time zones.