Bell 32V release
[unix-history] / usr / man / man3 / ctime.3
CommitLineData
e2137ef3
TL
1.TH CTIME 3
2.SH NAME
3ctime, localtime, gmtime, asctime, timezone \- convert date and time to ASCII
4.SH SYNOPSIS
5.B char *ctime(clock)
6.br
7.B long *clock;
8.PP
9.B #include <time.h>
10.PP
11.B struct tm *localtime(clock)
12.br
13.B long *clock;
14.PP
15.B struct tm *gmtime(clock)
16.br
17.B long *clock;
18.PP
19.B char *asctime(tm)
20.br
21.B struct tm *tm;
22.PP
23.B char *timezone(zone, dst)
24.SH DESCRIPTION
25.I Ctime
26converts a time pointed to by
27.I clock
28such as returned by
29.IR time (2)
30into ASCII
31and returns a pointer to a
3226-character string
33in the following form.
34All the fields have constant width.
35.PP
36 Sun Sep 16 01:03:52 1973\\n\\0
37.PP
38.I Localtime
39and
40.I gmtime
41return pointers to structures containing
42the broken-down time.
43.I Localtime
44corrects for the time zone and possible daylight savings time;
45.I gmtime
46converts directly to GMT, which is the time UNIX uses.
47.I Asctime
48converts a broken-down time to ASCII and returns a pointer
49to a 26-character string.
50.PP
51The structure declaration from the include file is:
52.RS
53.PP
54.nf
55.so /usr/include/time.h
56.fi
57.RE
58.PP
59These quantities give the time on a 24-hour clock,
60day of month (1-31), month of year (0-11), day of week
61(Sunday = 0), year \- 1900, day of year (0-365),
62and a flag that is nonzero if daylight saving time is in effect.
63.PP
64When local time is called for,
65the program consults the system to determine the time zone and
66whether the standard U.S.A. daylight saving time adjustment is
67appropriate.
68The program knows about the peculiarities
69of this conversion in 1974 and 1975;
70if necessary,
71a table for these years can be extended.
72.PP
73.I Timezone
74returns the name of the time zone associated with its first argument,
75which is measured in minutes westward from Greenwich.
76If the second argument is 0, the standard name is used,
77otherwise the Daylight Saving version.
78If the required name does not appear in a table
79built into the routine,
80the difference from GMT is produced; e.g.
81in Afghanistan
82.I timezone(-(60*4+30), 0)
83is appropriate because it is 4:30 ahead of GMT
84and the string
85.B GMT+4:30
86is produced.
87.SH "SEE ALSO"
88time(2)
89.SH BUGS
90The return values point to static data
91whose content is overwritten by each call.