Annotation of researchv10dc/man/adm/man3/timec.3, revision 1.1.1.1

1.1       root        1: .TH TIMEC 3
                      2: .CT 2 data_man time_man
                      3: .SH NAME
                      4: timec, timegm, timelocal \- convert ASCII to time
                      5: .SH SYNOPSIS
                      6: .nf
                      7: .B #include <time.h>
                      8: .PP
                      9: .B long timec(string)
                     10: .B char *string;
                     11: .PP
                     12: .B long timegm(timep)
                     13: .B struct tm *timep;
                     14: .PP
                     15: .B long timelocal(timep, zone)
                     16: .B struct tm *timep;
                     17: .B char *zone;
                     18: .fi
                     19: .SH DESCRIPTION
                     20: These routines are inverse to
                     21: .IR ctime (3)
                     22: and its relatives.
                     23: See
                     24: .IR ctime (3)
                     25: for data layouts.
                     26: .PP
                     27: .I Timec
                     28: converts to system format a date
                     29: .I string
                     30: as produced by
                     31: .I ctime,
                     32: .IR date (1),
                     33: or
                     34: .IR ls (1).
                     35: An optional day of the week is ignored.
                     36: A month name and day are required.
                     37: A missing hour:min[:sec] field is taken to be 
                     38: .BR 00:00:00 .
                     39: An optional time zone (local time by default)
                     40: may appear before or after the year.
                     41: A missing year is assumed to be the past 12-month interval.
                     42: .PP
                     43: .I Timegm
                     44: returns the system-format time corresponding to
                     45: the broken-down GMT time
                     46: pointed to by
                     47: .IR timep .
                     48: In a copy of the broken-down time
                     49: .BR tm_mon 
                     50: is reduced mod 12 by carrying (positively or negatively) to
                     51: .BR tm_year .
                     52: Next
                     53: .B tm_mon
                     54: and
                     55: .B tm_mday
                     56: are added to
                     57: .B tm_yday
                     58: appropriately for
                     59: .BR tm_year .
                     60: Then
                     61: .BR tm_sec ,
                     62: .BR tm_min ,
                     63: .BR tm_hour ,
                     64: .BR tm_yday ,
                     65: and
                     66: .B tm_year 
                     67: are adjusted by carrying.
                     68: Finally the system-format date
                     69: is calculated from these 5 fields.
                     70: .PP
                     71: .I Timelocal
                     72: is like
                     73: .I timegm,
                     74: except that the broken-down time belongs to the specified time
                     75: .I zone,
                     76: or is local time if
                     77: .I zone 
                     78: is zero.
                     79: .PP
                     80: Time zones and months are recognized by the first three
                     81: characters, regardless of case.
                     82: .I Strings
                     83: for
                     84: .I ctime
                     85: may contain names longer than three characters
                     86: and may contain extra white space and commas.
                     87: .SH EXAMPLES
                     88: .TP
                     89: Set a date ahead one month:
                     90: .EX
                     91: struct tm brk_out = *localtime(&date);
                     92: brk_out.tm_yday = 0;
                     93: brk_out.tm_mon++; 
                     94: date = timelocal(&brk_out,0);
                     95: .EE
                     96: .HP
                     97: Convert a
                     98: .IR date (1)
                     99: string to system format:
                    100: .EX
                    101: date = timec("Sat Sep 27 20:59:11 EDT 1986");
                    102: .EE
                    103: .SH SEE ALSO
                    104: .IR ctime (3),
                    105: .IR time (2)
                    106: .SH BUGS
                    107: Unknown time zone names are taken to be GMT.
                    108: .br
                    109: Times before the epoch yield nonsense.

unix.superglobalmegacorp.com

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