Annotation of 43BSD/contrib/notes/man/getdate.3, revision 1.1.1.1

1.1       root        1: .TH GETDATE 3 unc
                      2: .SH NAME
                      3: getdate \- convert time and date from ASCII
                      4: .SH SYNOPSIS
                      5: .B #include <sys/types.h>
                      6: .br
                      7: .B #include <sys/timeb.h>
                      8: .PP
                      9: .B time_t getdate(buf, now)
                     10: .br
                     11: .B char *buf;
                     12: .br
                     13: struct timeb *now;
                     14: .SH DESCRIPTION
                     15: .I Getdate
                     16: is a routine that converts most common time specifications to standard UNIX
                     17: format.  The first argument is the character string containing the
                     18: time and date; the second is the assumed current time (used for relative
                     19: specifications); if
                     20: .B NULL
                     21: is passed,
                     22: .IR ftime (2)
                     23: is used to obtain the current time and timezone.
                     24: .PP
                     25: The character string consists of 0 or more specifications of the following
                     26: form:
                     27: .TP .75i
                     28: tod
                     29: A
                     30: .I tod
                     31: is a time of day, which is of the form
                     32: .IR hh : mm [: ss ]
                     33: (or
                     34: .IR hhmm )
                     35: .RI [ meridian ]
                     36: .RI [ zone ].
                     37: If no meridian \-
                     38: .B am
                     39: or
                     40: .B pm
                     41: \- is specified, a 24-hour clock is used.  A
                     42: .I tod
                     43: may be specified as just
                     44: .I hh
                     45: followed by a
                     46: .IR meridian.
                     47: .TP .75i
                     48: date
                     49: A
                     50: .I date
                     51: is a specific month and day, and possibly a year.  Acceptable formats are
                     52: .IR mm/dd [ /yy ]
                     53: and
                     54: .IR "monthname dd" "[, " yy ]
                     55: If omitted, the year defaults to the
                     56: current year; if a year is specified
                     57: as a number less than 100, 1900 is added.
                     58: If a number not followed by a day or relative time unit occurs, it will
                     59: be interpreted as a year if a
                     60: .IR tod ,
                     61: .IR monthname ,
                     62: and
                     63: .I dd
                     64: have already been specified; otherwise, it will be treated as a
                     65: .IR tod .
                     66: This rule allows the output from
                     67: .IR date (1)
                     68: or
                     69: .IR ctime (3)
                     70: to be passed as input to
                     71: .IR getdate .
                     72: .TP .75i
                     73: day
                     74: A
                     75: .I day
                     76: of the week may be specified; the current day will be used if appropriate.
                     77: A
                     78: .I day
                     79: may be preceeded by a
                     80: .IR number,
                     81: indicating which instance of that day is desired; the default is
                     82: .BR 1 .
                     83: Negative
                     84: .I numbers
                     85: indicate times past.  Some symbolic
                     86: .I numbers
                     87: are accepted:
                     88: .BR last ,
                     89: .BR next ,
                     90: and the ordinals
                     91: .B first
                     92: through
                     93: .B twelfth
                     94: .RB ( second
                     95: is ambiguous, and is not accepted as an ordinal number).
                     96: The symbolic number
                     97: .B next
                     98: is equivalent to
                     99: .BR 2 ;
                    100: thus,
                    101: .I "next monday"
                    102: refers not to the immediately coming Monday, but to the one a week later.
                    103: .TP .75i
                    104: relative time
                    105: Specifications relative to the current time are also accepted.  
                    106: The format is
                    107: .RI [ number "] " unit ;
                    108: acceptable units are
                    109: .BR year ,
                    110: .BR month ,
                    111: .BR fortnight ,
                    112: .BR week ,
                    113: .BR day ,
                    114: .BR hour ,
                    115: .BR minute ,
                    116: and
                    117: .BR second .
                    118: .PP
                    119: The actual date is formed as follows:  first, any absolute date and/or time
                    120: is processed and converted.  Using that time as the base, day-of-week
                    121: specifications are added; last, relative specifications are used.  If a
                    122: date or day is specified, and no absolute or relative time is given, midnight
                    123: is used.
                    124: Finally, a correction is applied so that the correct hour of the day is
                    125: produced after allowing for daylight savings time differences.
                    126: .PP
                    127: .I Getdate
                    128: accepts most common abbreviations for days, months, etc.; in particular,
                    129: it will recognize them with upper or lower case first letter, and will
                    130: recognize three-letter abbreviations for any of them, with or without
                    131: a trailing period.  Units, such as
                    132: .BR week s,
                    133: may be specified in the singular or plural.  Timezone and meridian
                    134: values may be in upper or lower case, and with or without periods.
                    135: .SH FILES
                    136: /usr/lib/libu.a
                    137: .SH "SEE ALSO"
                    138: ctime(3), time(2)
                    139: .SH AUTHOR
                    140: Steven M. Bellovin (unc!smb)
                    141: .br
                    142: Dept. of Computer Science
                    143: .br
                    144: University of North Carolina at Chapel Hill
                    145: .SH BUGS
                    146: Because
                    147: .IR yacc (1)
                    148: is used to parse the date,
                    149: .I getdate
                    150: cannot be used a subroutine to any program that also needs
                    151: .IR yacc .
                    152: .br
                    153: The grammar and scanner are rather primitive; certain desirable and
                    154: unambiguous constructions are not accepted.  Worse yet, the meaning of
                    155: some legal phrases is not what is expected;
                    156: .I next week
                    157: is identical to
                    158: .IR "2 weeks" .
                    159: .br
                    160: The daylight savings time correction is not perfect, and can get confused
                    161: if handed times between midnight and 2:00 am on the days that the
                    162: reckoning changes.
                    163: .br
                    164: Because
                    165: .IR localtime (2)
                    166: accepts an old-style time format without zone information, attempting
                    167: to pass
                    168: .I getdate
                    169: a current time containing a different zone will probably fail.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.