.TH GETABSDATE 3 "27 February 1991" .SH NAME getabsdate, prsabsdate, getindate, prsindate \- date and time parsers .SH SYNOPSIS .ft B .nf #include #include .sp 0.3 time_t getabsdate(str, now) char *str; struct timeb *now; .sp 0.3 time_t getindate(str, now) char *str; struct timeb *now; .sp 0.3 #include .sp 0.3 int prsabsdate(str, now, tm, tzp) char *str; struct timeb *now; struct tm *tm; int *tzp; .sp 0.3 int prsindate(str, tm, tzp) char *str; struct tm *tm; int *tzp; .fi .ft .SH DESCRIPTION .I Getabsdate and .I getindate parse dates (in .IR str ) and convert them to .I time_t s (seconds since the epoch). .I Prsabsdate and .I prsindate parse dates and produce broken-out time structures and time zones instead. All are faster and smaller than .IR getdate (3). .I Getindate and .I prsindate are faster than .I getabsdate and .IR prsabsdate , but .I getindate and .I prsindate only parse Internet dates (as specified in Internet RFCs 822 and 1123). .PP .I Getabsdate and .I 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. .PP .I Getindate and .I 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 .I getabsdate or .I prsabsdate in any case. .\" .SH FILES .SH SEE ALSO .IR ctime (3), .IR mktime (3) .br Internet RFCs 822 and 1123 .SH DIAGNOSTICS All return a negative value on error. .SH 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 .IR getdate (3), Rayan Zachariassen and Rich Wales. Corrections to the time zone table from Paul Eggert. .SH BUGS .I Getabsdate and .I prsabsdate modify their .I str arguments. .PP The treatment of dashes in .I getabsdate and .I prsabsdate is a hack to permit parsing of dates in DEC format (31-Jan-91), which is itself a botch, so we're even. .PP Alphabetic time zones are wildly ambiguous; don't use them. .PP 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? .PP Daylight savings time is a patchwork mess only a politician could love. .PP Weekday names are too long and redundant. Did the Norse have weak memories? .PP Leap years are a pain; the earth should be stabilised.