Penguin
Annotated edit history of asctime(3) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 CTIME
2 !!!CTIME
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 CONFORMING TO
7 SEE ALSO
8 ----
9 !!NAME
10
11
12 asctime, ctime, gmtime, localtime, mktime - transform binary date and time to ASCII
13 !!SYNOPSIS
14
15
16 __#include
17 __''timeptr''__);
18 char *ctime(const time_t *__''timep''__);
19 struct tm *gmtime(const time_t *__''timep''__);
20 struct tm *localtime(const time_t *__''timep''__);
21 time_t mktime(struct tm *__''timeptr''__);
22 extern char *__''tzname''__[[2];
23 long int__ ''timezone''__;
24 extern int__ ''daylight''__;
25 __
26 !!DESCRIPTION
27
28
29 The __ctime()__, __gmtime()__ and __localtime()__
30 functions all take an argument of data type ''time_t''
31 which represents calendar time. When interpreted as an
32 absolute time value, it represents the number of seconds
33 elapsed since 00:00:00 on January 1, 1970, Coordinated
34 Universal Time (UTC).
35
36
37 The __asctime()__ and __mktime()__ functions both take
38 an argument representing broken-down time which is a binary
39 representation separated into year, month, day, etc.
40 Broken-down time is stored in the structure ''tm'' which
41 is defined in '''' as follows:
42
43
44 struct tm
45 {
46 int tm_sec; /* seconds */
47 int tm_min; /* minutes */
48 int tm_hour; /* hours */
49 int tm_mday; /* day of the month */
50 int tm_mon; /* month */
51 int tm_year; /* year */
52 int tm_wday; /* day of the week */
53 int tm_yday; /* day in the year */
54 int tm_isdst; /* daylight saving time */
55 };
56
57
58 The members of the ''tm'' structure are:
59
60
61 ''tm_sec''
62
63
64 The number of seconds after the minute, normally in the
65 range 0 to 59, but can be up to 61 to allow for leap
66 seconds.
67
68
69 ''tm_min''
70
71
72 The number of minutes after the hour, in the range 0 to
73 59.
74
75
76 ''tm_hour''
77
78
79 The number of hours past midnight, in the range 0 to
80 23.
81
82
83 ''tm_mday''
84
85
86 The day of the month, in the range 1 to 31.
87
88
89 ''tm_mon''
90
91
92 The number of months since January, in the range 0 to
93 11.
94
95
96 ''tm_year''
97
98
99 The number of years since 1900.
100
101
102 ''tm_wday''
103
104
105 The number of days since Sunday, in the range 0 to
106 6.
107
108
109 ''tm_yday''
110
111
112 The number of days since January 1, in the range 0 to
113 365.
114
115
116 ''tm_isdst''
117
118
119 A flag that indicates whether daylight saving time is in
120 effect at the time described. The value is positive if
121 daylight saving time is in effect, zero if it is not, and
122 negative if the information is not available.
123
124
125 The __ctime()__ function converts the calendar time
126 ''timep'' into a string of the form
127
128
129
130
131 The abbreviations for the days of the week are `Sun', `Mon',
132 `Tue', `Wed', `Thu', `Fri', and `Sat'. The abbreviations for
133 the months are `Jan', `Feb', `Mar', `Apr', `May', `Jun',
134 `Jul', `Aug', `Sep', `Oct', `Nov', and `Dec'. The return
135 value points to a statically allocated string which might be
136 overwritten by subsequent calls to any of the date and time
137 functions. The function also sets the external variable
138 ''tzname'' with information about the current time
139 zone.
140
141
142 The __gmtime()__ function converts the calendar time
143 ''timep'' to broken-down time representation, expressed
144 in Coordinated Universal Time (UTC).
145
146
147 The __localtime()__ function converts the calendar time
148 ''timep'' to broken-time representation, expressed
149 relative to the user's specified time zone. The function
150 sets the external variables ''tzname'' with information
151 about the current time zone, ''timezone'' with the
152 difference between Coordinated Universal Time (UTC) and
153 local standard time in seconds, and ''daylight'' to a
154 non-zero value if standard US daylight savings time rules
155 apply.
156
157
158 The __asctime()__ function converts the broken-down time
159 value ''timeptr'' into a string with the same format as
160 __ctime()__. The return value points to a statically
161 allocated string which might be overwritten by subsequent
162 calls to any of the date and time functions.
163
164
165 The __mktime()__ function converts a broken-down time
166 structure, expressed as local time, to calendar time
167 representation. The function ignores the specified contents
168 of the structure members ''tm_wday'' and ''tm_yday''
169 and recomputes them from the other information in the
170 broken-down time structure. If structure members are outside
171 their legal interval, they will be normalized (so that,
172 e.g., 40 October is changed into 9 November). Calling
173 __mktime()__ also sets the external variable
174 ''tzname'' with information about the current time zone.
175 If the specified broken-down time cannot be represented as
176 calendar time (seconds since the epoch), __mktime()__
177 returns a value of (time_t)(-1) and does not alter the
178 ''tm_wday'' and ''tm_yday'' members of the broken-down
179 time structure.
180 !!CONFORMING TO
181
182
183 SVID 3, POSIX, BSD 4.3, ISO 9899
184 !!SEE ALSO
185
186
187 date(1), gettimeofday(2), time(2),
188 tzset(3), difftime(3),
189 strftime(3).
190 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.