|
|
1.1 ! root 1: .TH CTIME 3 ! 2: .CT 2 data_man time_man ! 3: .SH NAME ! 4: ctime, localtime, gmtime, asctime, timezone \(mi convert date and time to ASCII ! 5: .SH SYNOPSIS ! 6: .B #include <time.h> ! 7: .PP ! 8: .nf ! 9: .B char *ctime(clock) ! 10: .B long *clock; ! 11: .PP ! 12: .B struct tm *localtime(clock) ! 13: .B long *clock; ! 14: .PP ! 15: .B struct tm *gmtime(clock) ! 16: .B long *clock; ! 17: .PP ! 18: .B char *asctime(tm) ! 19: .B struct tm *tm; ! 20: .PP ! 21: .B char *timezone(zone, dst) ! 22: .fi ! 23: .SH DESCRIPTION ! 24: .I Ctime ! 25: converts a time pointed to by ! 26: .I clock ! 27: such as returned by ! 28: .IR time (2) ! 29: into ASCII ! 30: and returns a pointer to a ! 31: 26-character string ! 32: in the following form. ! 33: All the fields have constant width. ! 34: .PP ! 35: .L ! 36: Sun Sep 16 01:03:52 1973\en\e0 ! 37: .PP ! 38: .I Localtime ! 39: and ! 40: .I gmtime ! 41: return pointers to structures containing ! 42: the broken-down time. ! 43: .I Localtime ! 44: corrects for the time zone and possible daylight savings time; ! 45: .I gmtime ! 46: converts directly to GMT, which is the time UNIX uses. ! 47: .I Asctime ! 48: converts a broken-down time to ASCII and returns a pointer ! 49: to a 26-character string. ! 50: .LP ! 51: .ta 8n +16n ! 52: .nf ! 53: \fLstruct tm { ! 54: \fLint tm_sec;\fR seconds (range 0..59) ! 55: \fLint tm_min;\fP minutes (0..59) ! 56: \fLint tm_hour;\fP hours (0..23) ! 57: \fLint tm_mday;\fP day of the month (1..31) ! 58: \fLint tm_mon;\fP month of the year (0..11) ! 59: \fLint tm_year;\fP year A.D. \- 1900 ! 60: \fLint tm_wday;\fP day of week (0..6, Sunday = 0) ! 61: \fLint tm_yday;\fP day of year (0..365) ! 62: \fLint tm_isdst;\fP zero means normal time, nonzero means daylight saving time ! 63: \fL};\fR ! 64: .fi ! 65: .PP ! 66: When local time is called for, ! 67: the program consults the system to determine the time zone and ! 68: whether the standard U.S.A. daylight saving time adjustment is ! 69: appropriate. ! 70: The peculiarities of this conversion ! 71: are read from the file ! 72: .FR /lib/dst , ! 73: which contains lines of the form ! 74: .IP ! 75: .I "y0 y1 bmon bday boff emon eday eoff" ! 76: .LP ! 77: meaning that for years between ! 78: .I y0 ! 79: and ! 80: .IR y1 ! 81: inclusive, ! 82: daylight saving time begins (ends) ! 83: .IR boff ! 84: .RI ( eoff ) ! 85: days after the first Sunday ! 86: after ! 87: the day ! 88: .IR bmon / bday ! 89: .RI ( emon / eday ). ! 90: .PP ! 91: .I Timezone ! 92: returns the name of the time zone associated with its first argument, ! 93: which is measured in minutes westward from Greenwich. ! 94: If the second argument is 0, the standard name is used, ! 95: otherwise the Daylight Saving version. ! 96: If the required name does not appear in a table ! 97: built into the routine, ! 98: the difference from GMT is produced. ! 99: Thus, as Afghanistan is 4:30 ahead of GMT, ! 100: .L ! 101: timezone(-(60*4+30),\ 0) \fRreturns\fL "GMT+4:30"\fR. ! 102: .SH "SEE ALSO" ! 103: .IR time (2), ! 104: .IR timec (3) ! 105: .SH BUGS ! 106: The return values point to static data ! 107: whose content is overwritten by each call.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.