📄 parsedate.3
字号:
.\" $Revision: 1.10 $.TH PARSEDATE 3.SH NAMEparsedate \- convert time and date string to number.SH SYNOPSIS.nf.ta \w' unsigned long 'u.B "#include <sys/types.h>".B "typedef struct _TIMEINFO {".B " time_t time;".B " long usec;".B " long tzone;.B "} TIMEINFO;".B "time_t".B "parsedate(text, now)".B " char *text;".B " TIMEINFO *now;".fi.SH DESCRIPTION.I Parsedateconverts many common time specifications into the number of secondssince the epoch \(em.IR i.e. ,a.IR time_t ;see.IR time (2)..PP.I Parsedatereturns the time, or \-1 on error..I Textis a character string containing the time and date..I Nowis a pointer to the time that should be used for calculating relative dates.If.I nowis NULL, then.I GetTimeInfo in.IR libinn (3)is used to obtain the current time and timezone..PPThe character string consists of zero or more specifications of the followingform:.TP.I timeA time of day, which is of the form.IR hh [ :mm [ :ss ]].RI [ meridian ].RI [ zone ]or.IR hhmm.RI [ meridian ].RI [ zone ].If no meridian is specified,.I hhis interpreted on a 24-hour clock..TP.I dateA specific month and day with optional year.The acceptable formats are.IR mm/dd [ /yy ],.IR yyyy/mm/dd ,.IR "monthname dd" "[, " yy ],.IR "dd monthname" " [" yy "],and.IR "day, dd monthname yy" .The default year is the current year.If the year is less then 100, then 1900 is added to it; if it isless then 21, then 2000 is added to it..TP.I "relative time"A specification relative to the current time.The format is.IR "number unit" ;acceptable units are.IR year ,.IR month ,.IR week ,.IR day ,.IR hour ,.I minute(or.IR min ),and.I second(or.IR sec ).The unit can be specified as a singular or plural, as in.IR "3 weeks" ..PPThe actual date is calculated according to the following steps.First, any absolute date and/or time is processed and converted.Using that time as the base, day-of-week specifications are added.Next, relative specifications are used.If a date or day is specified, and no absolute or relative time is given,midnight is used.Finally, a correction is applied so that the correct hour of the day isproduced after allowing for daylight savings time differences..PP.I Parsedateignores case when parsing all words; unknown words are taken to be unknowntimezones, which are treated as GMT.The names of the months and days of the week can be abbreviated to theirfirst three letters, with optional trailing period.Periods are ignored in any timezone or meridian values..SH BUGS.I Parsedatedoes not accept all desirable and unambiguous constructions.Semantically incorrect dates such as ``February 31'' are accepted..PPDaylight savings time is always taken as a one-hour change which is wrongfor some places.The daylight savings time correction can get confused if parsing atime within an hour of when the reckoning changes, or if given apartial date..SH HISTORYOriginally written by Steven M. Bellovin <smb@research.att.com> whileat the University of North Carolina at Chapel Hill and distributedunder the name.IR getdate ..PPA major overhaul was done by Rich $alz <rsalz@bbn.com> and Jim Berets<jberets@bbn.com> in August, 1990..PPIt was further revised (primarily to remove obsolete constructs and timezonenames) a year later by Rich (now <rsalz@osf.org>) for InterNetNews,and the name was changed..de R$This is revision \\$3, dated \\$4....R$ $Id: parsedate.3,v 1.10 1993/01/29 16:43:12 rsalz Exp $.SH "SEE ALSO"date(1),ctime(3),libinn(3),time(2).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -