Commit Graph

66 Commits

Author SHA1 Message Date
Jim Meyering
aa07786952 (get_date): Fix typo in time_t overflow test.
From Michael Stone.
1999-12-22 11:14:05 +00:00
Jim Meyering
dab2c2f26f update a comment from alpha.gnu.org:/home/gd/gnu/lib/getdate.y 1999-10-31 15:49:05 +00:00
Jim Meyering
1ca4f162fa (__attribute__): Define to empty if GCC claims to
be before 2.8; this is needed for OPENStep 4.2 cc.  Also,
define to empty if strict ANSI.
1999-10-04 05:59:37 +00:00
Jim Meyering
d45400c9a9 (relative_time_table): Change type' of THIS' from
tMINUTE_UNIT to tUNUMBER.  From Urs Thuermann.
1999-08-29 14:55:24 +00:00
Jim Meyering
6b840273e0 (get_date): Rename latter local `tm' to probe_tm. 1999-08-29 12:55:35 +00:00
Jim Meyering
9f92dfbf90 (get_date): Rename outermost local probe' to quarter'. 1999-08-29 12:28:56 +00:00
Jim Meyering
26656272e8 Add copyright notice.
(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-29 07:29:51 +00:00
Jim Meyering
12fbee444c (OtherTable[]): Use tDAY_UNIT for `tomorrow,'
`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-08-07 09:50:34 +00:00
Jim Meyering
0f5bb7dd4e add the comment to go with last change 1999-05-20 03:49:25 +00:00
Jim Meyering
a0766fb80f (get_date): Let mktime deduce tm_isdst if we
have an absolute timestamp, or if the relative timestamp
mentions days, months, or years.
1999-05-20 03:47:24 +00:00
Jim Meyering
cc7d631369 <stdlib.h>: Include if HAVE_STDLIB_H, since bison 1.27 invokes "free".
(LookupWord, yylex): Don't pass negative char to ctype macros.
1999-04-18 23:17:30 +00:00
Jim Meyering
1ff7d4be9b (difftm): Protoize. 1999-04-07 17:43:36 +00:00
Jim Meyering
7549c10f35 (get_date): Reuse tm_isdst of first localtime
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-03-28 20:58:51 +00:00
Jim Meyering
fce748fe1f <alloca.h>: Include if HAVE_ALLOCA_H, not FORCE_ALLOCA_H.
The FORCE_ALLOCA_H was a relic of the bad old pre-autoconf Emacs days.
1999-02-19 07:31:48 +00:00
Jim Meyering
50225cad77 Fix warnings from gcc -W -Wall
(__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-12-31 14:37:21 +00:00
Jim Meyering
7024c7d55c s/get-date.h/getdate.h/ 1998-03-14 16:31:51 +00:00
Jim Meyering
f8d66bde6a s/getdate.h/get-date.h/ 1998-02-20 21:42:11 +00:00
Jim Meyering
0fdd1b9130 Add %expect directive.
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.
1998-01-06 23:53:33 +00:00
Jim Meyering
2c0e561933 (OtherTable): Interpret `next' as 1 (not 2) units.
Patch from Richard Sharman <rsharman@magmacom.com>.
1997-06-01 17:15:51 +00:00
Jim Meyering
7f74dcb1a6 s/;/. in comment to placate francois 1997-04-10 03:46:01 +00:00
Jim Meyering
8c93627ccb (tYEAR_UNIT): Increase yyRelYear by $1, not just by 1.
From Andreas Schwab.
1997-02-27 05:53:15 +00:00
Jim Meyering
db78b4797a (tMONTH_UNIT): Increase yyRelMonth by $1, not just by 1.
(tDAY_UNIT): Likewise for yyRelDay.
(tHOUR_UNIT): Likewise for yyRelHour.
(tMINUTE_UNIT): Likewise for yyRelMinutes.
(tSEC_UNIT): Likewise for yyRelSeconds.
1997-02-22 20:13:19 +00:00
Jim Meyering
b969dad022 Indent with GNU indent. 1997-01-18 20:17:39 +00:00
Jim Meyering
c1db691c12 Indent 2 more cpp-directives to reflect nesting. 1997-01-18 20:12:10 +00:00
Jim Meyering
5f9c33edfe (get_date): Change prototype to reflect const'ness of parameters.
Indent cpp-directives to reflect nesting.
1997-01-18 20:11:05 +00:00
Jim Meyering
6e5149f0ab 1997-01-06 Paul Eggert <eggert@twinsun.com>
* 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.
1997-01-18 15:32:16 +00:00
Jim Meyering
859f8587f8 add blank line. 1996-12-18 03:28:09 +00:00
Jim Meyering
86d6c36d09 (IN_CTYPE_DOMAIN): Rename from ISASCII.
(ISDIGIT): New definition from Paul Eggert.
This one evaluates its argument exactly once.
(yylex): Move increment out of ISALPHA argument.  Use a
comma-expression instead.
1996-12-13 03:05:00 +00:00
Jim Meyering
8f477a9072 (Convert): Don't reject all dates in 2038.
Some fit in 31 bits.
1996-12-10 04:34:18 +00:00
Jim Meyering
807b8b05c2 (date): Interpret the date, L/M/N, as YYYY/MM/DD
if L >= 1000, otherwise as MM/DD/YY.  With this change,
date --date=DATE accepts dates like those in an RCS log listing.
1996-12-01 19:15:03 +00:00
Jim Meyering
b5a71af82a Remap yacc globals to have gd_ prefix.
Suggestion to do as in gdb/c-exp.y from Tom Tromey.
1996-11-01 00:32:12 +00:00
Jim Meyering
d2c6e7cba9 Define and use upper case variants of ctype.h IS* macros.
From Bruno Haible.
1996-09-07 17:42:58 +00:00
Jim Meyering
9379b5aed5 Merge changes from FSF. 1996-03-10 05:00:20 +00:00
Jim Meyering
aaa9cb7c22 (RelativeMonth): Add 1900 to the year so that relative date specs
that push the year through the end of the century work.  For example,
`date -d "01/01/1998 3 years" +%Y' now prints 2001.
From Peter Dalgaard (pd@kubism.ku.dk).
1996-03-06 04:57:01 +00:00
Jim Meyering
7c342fe2a1 Add FIXME comments. 1995-08-07 16:07:28 +00:00
Jim Meyering
a2e52e58b1 (Convert): Use 2037 as threshold, not 1999.
Otherwise years after 1999 are treated as invalid.
From Andreas Schwab.
1995-06-07 18:10:17 +00:00
Jim Meyering
b38a5a7a17 . 1995-01-27 15:01:25 +00:00
Jim Meyering
4ecaaf1fa7 . 1995-01-27 15:00:54 +00:00
Jim Meyering
66444bdafb Remove/rewrite some comments. 1995-01-27 05:36:14 +00:00
Jim Meyering
b554fee401 . 1995-01-27 05:22:23 +00:00
Jim Meyering
d734172c73 merge with 1.10q 1994-10-08 00:40:55 +00:00
Jim Meyering
e13a0b7f49 merge with 1.10n1 1994-09-27 20:52:02 +00:00
Jim Meyering
451fa3013e . 1994-09-25 01:25:18 +00:00
Jim Meyering
1ba691350b merge with 1.10m 1994-09-24 19:12:46 +00:00
Jim Meyering
73b9e4b762 merge with 1.10j 1994-09-17 02:46:48 +00:00
Jim Meyering
00dceaff2e merge with 1.10i 1994-09-08 04:48:40 +00:00
Jim Meyering
de8c62d0f0 merge with 1.10h 1994-09-01 23:20:29 +00:00
Jim Meyering
085c609f77 merge with 1.9.4g 1994-04-25 18:34:37 +00:00
Jim Meyering
256a906698 merge with 1.9.4f 1994-04-25 16:34:49 +00:00
Jim Meyering
7c68f857d0 Revert 1.14-1.16 changes that removed difftm and modified get_date. 1994-04-24 12:48:45 +00:00