GETABSDATE(3) UNIX System V(27 February 1991) GETABSDATE(3)
NAME
getabsdate, prsabsdate, getindate, prsindate - date and time parsers
SYNOPSIS
#include <sys/types.h>
#include <sys/timeb.h>
time_t getabsdate(str, now)
char *str;
struct timeb *now;
time_t getindate(str, now)
char *str;
struct timeb *now;
#include <time.h>
int prsabsdate(str, now, tm, tzp)
char *str;
struct timeb *now;
struct tm *tm;
int *tzp;
int prsindate(str, tm, tzp)
char *str;
struct tm *tm;
int *tzp;
DESCRIPTION
Getabsdate and getindate parse dates (in str) and convert them to time_t
s (seconds since the epoch). Prsabsdate and prsindate parse dates and
produce broken-out time structures and time zones instead. All are
faster and smaller than getdate(3). Getindate and prsindate are faster
than getabsdate and prsabsdate, but getindate and prsindate only parse
Internet dates (as specified in Internet RFCs 822 and 1123).
Getabsdate and prsabsdate parse fairly arbitrary absolute dates: each
date must contain a day-of-month, English month name, and two- or four-
digit year, and may optionally contain a colon-separated time (with
optional seconds), weekday name, and signed numeric or alphabetic time
zone. The day-of-month must precede the year, but no other ordering is
assumed. Four-digit years are encouraged. Delimiters are space, tab,
newline, slash, and comma; dashes are only delimiters if the date cannot
otherwise be parsed. All-numeric dates are ambiguous and are rejected.
Unknown words are assumed to be bogus timezones and are ignored.
American military time zones are not supported. Alphabetic time zones
other than GMT are deprecated.
Getindate and prsindate parse RFC 822 dates, as amended by RFC 1123 (GMT
is strongly encouraged). These routines are intended to be used to parse
dates suspected to be machine-generated or otherwise likely to be in the
right format. Due to their extreme speed, they may be used as a pre-pass
before calling getabsdate or prsabsdate in any case.
SEE ALSO
ctime(3), mktime(3)
Internet RFCs 822 and 1123
10/89 Page 1
GETABSDATE(3) UNIX System V(27 February 1991) GETABSDATE(3)
DIAGNOSTICS
All return a negative value on error.
HISTORY
Written at the University of Toronto by Geoff Collyer and Mark Moraes
(who regret ever getting involved with date parsing). Bits of code
borrowed with permission from getdate(3), Rayan Zachariassen and Rich
Wales.
BUGS
Getabsdate and prsabsdate modify their str arguments.
The treatment of dashes in getabsdate and prsabsdate is a hack to permit
parsing of dates in DEC format (31-Jan-91), which is itself a botch, so
we're even.
Alphabetic time zones are wildly ambiguous; don't use them.
The Gregorian calendar is a kludge only an innumerate could love. When
will someone impose a metric calendar and free us from the vanity and
incompetence of the Roman emperors, notably the random lengths of months?
Daylight savings time is a patchwork mess only a politician could love.
Weekday names are too long and redundant. Did the Norse have weak
memories?
Leap years are a pain; the earth should be stabilised.
Page 2 10/89