Age | Commit message (Collapse) | Author |
|
(day, relunit): Allow it for relative times.
(relative_time_table): Use tORDINAL for ordinals.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
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.
|
|
|
|
"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.
|
|
|
|
|
|
|
|
|
|
Add three semicolons, each just before a closing brace.
Bison (as of version 1.31) no longer papers over that mistake.
|
|
|
|
|
|
|
|
(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.
|
|
|
|
(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.
|
|
|
|
From Michael Stone.
|
|
|
|
be before 2.8; this is needed for OPENStep 4.2 cc. Also,
define to empty if strict ANSI.
|
|
tMINUTE_UNIT to tUNUMBER. From Urs Thuermann.
|
|
|
|
|
|
(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.
|
|
`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.
|
|
|
|
have an absolute timestamp, or if the relative timestamp
mentions days, months, or years.
|
|
(LookupWord, yylex): Don't pass negative char to ctype macros.
|
|
|
|
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.
|
|
The FORCE_ALLOCA_H was a relic of the bad old pre-autoconf Emacs days.
|
|
(__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.
|
|
|
|
|
|
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.
|
|
Patch from Richard Sharman <rsharman@magmacom.com>.
|
|
|
|
From Andreas Schwab.
|
|
(tDAY_UNIT): Likewise for yyRelDay.
(tHOUR_UNIT): Likewise for yyRelHour.
(tMINUTE_UNIT): Likewise for yyRelMinutes.
(tSEC_UNIT): Likewise for yyRelSeconds.
|
|
|
|
|
|
Indent cpp-directives to reflect nesting.
|
|
* 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.
|