4 parsedate \- convert time and date string to number
7 .ta \w' unsigned long 'u
8 .B "#include <sys/types.h>"
10 .B "typedef struct _TIMEINFO {"
17 .B "parsedate(text, now)"
23 converts many common time specifications into the number of seconds
32 returns the time, or \-1 on error.
34 is a character string containing the time and date.
36 is a pointer to the time that should be used for calculating relative dates.
42 is used to obtain the current time and timezone.
44 The character string consists of zero or more specifications of the following
48 A time of day, which is of the form
56 If no meridian is specified,
58 is interpreted on a 24-hour clock.
61 A specific month and day with optional year.
62 The acceptable formats are
65 .IR "monthname dd" "[, " yy ],
66 .IR "dd monthname" " [" yy "],
68 .IR "day, dd monthname yy" .
69 The default year is the current year.
70 If the year is less then 100, then 1900 is added to it; if it is
71 less then 21, then 2000 is added to it.
74 A specification relative to the current time.
90 The unit can be specified as a singular or plural, as in
93 The actual date is calculated according to the following steps.
94 First, any absolute date and/or time is processed and converted.
95 Using that time as the base, day-of-week specifications are added.
96 Next, relative specifications are used.
97 If a date or day is specified, and no absolute or relative time is given,
99 Finally, a correction is applied so that the correct hour of the day is
100 produced after allowing for daylight savings time differences.
103 ignores case when parsing all words; unknown words are taken to be unknown
104 timezones, which are treated as GMT.
105 The names of the months and days of the week can be abbreviated to their
106 first three letters, with optional trailing period.
107 Periods are ignored in any timezone or meridian values.
110 does not accept all desirable and unambiguous constructions.
111 Semantically incorrect dates such as ``February 31'' are accepted.
113 Daylight savings time is always taken as a one-hour change which is wrong
115 The daylight savings time correction can get confused if parsing a
116 time within an hour of when the reckoning changes, or if given a
119 Originally written by Steven M. Bellovin <smb@research.att.com> while
120 at the University of North Carolina at Chapel Hill and distributed
124 A major overhaul was done by Rich $alz <rsalz@bbn.com> and Jim Berets
125 <jberets@bbn.com> in August, 1990.
127 It was further revised (primarily to remove obsolete constructs and timezone
128 names) a year later by Rich (now <rsalz@osf.org>) for InterNetNews,
129 and the name was changed.
131 This is revision \\$3, dated \\$4.
133 .R$ $Id: parsedate.3 6312 2003-05-04 21:40:11Z rra $