1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | #ifndef _TIME_H |
23 | |
24 | #if (! defined __need_time_t && !defined __need_clock_t && \ |
25 | ! defined __need_timespec) |
26 | # define _TIME_H 1 |
27 | # include <features.h> |
28 | |
29 | __BEGIN_DECLS |
30 | |
31 | #endif |
32 | |
33 | #ifdef _TIME_H |
34 | |
35 | # define __need_size_t |
36 | # define __need_NULL |
37 | # include <stddef.h> |
38 | |
39 | |
40 | |
41 | # include <bits/time.h> |
42 | |
43 | |
44 | # if !defined __STRICT_ANSI__ && !defined __USE_XOPEN2K |
45 | # ifndef CLK_TCK |
46 | # define CLK_TCK CLOCKS_PER_SEC |
47 | # endif |
48 | # endif |
49 | |
50 | #endif |
51 | |
52 | #if !defined __clock_t_defined && (defined _TIME_H || defined __need_clock_t) |
53 | # define __clock_t_defined 1 |
54 | |
55 | # include <bits/types.h> |
56 | |
57 | __BEGIN_NAMESPACE_STD |
58 | |
59 | typedef __clock_t clock_t; |
60 | __END_NAMESPACE_STD |
61 | #if defined __USE_XOPEN || defined __USE_POSIX |
62 | __USING_NAMESPACE_STD(clock_t) |
63 | #endif |
64 | |
65 | #endif |
66 | #undef __need_clock_t |
67 | |
68 | #if !defined __time_t_defined && (defined _TIME_H || defined __need_time_t) |
69 | # define __time_t_defined 1 |
70 | |
71 | # include <bits/types.h> |
72 | |
73 | __BEGIN_NAMESPACE_STD |
74 | |
75 | typedef __time_t time_t; |
76 | __END_NAMESPACE_STD |
77 | #ifdef __USE_POSIX |
78 | __USING_NAMESPACE_STD(time_t) |
79 | #endif |
80 | |
81 | #endif |
82 | #undef __need_time_t |
83 | |
84 | #if !defined __clockid_t_defined && \ |
85 | ((defined _TIME_H && defined __USE_POSIX199309) || defined __need_clockid_t) |
86 | # define __clockid_t_defined 1 |
87 | |
88 | # include <bits/types.h> |
89 | |
90 | |
91 | typedef __clockid_t clockid_t; |
92 | |
93 | #endif |
94 | #undef __clockid_time_t |
95 | |
96 | #if !defined __timer_t_defined && \ |
97 | ((defined _TIME_H && defined __USE_POSIX199309) || defined __need_timer_t) |
98 | # define __timer_t_defined 1 |
99 | |
100 | # include <bits/types.h> |
101 | |
102 | |
103 | typedef __timer_t timer_t; |
104 | |
105 | #endif |
106 | #undef __need_timer_t |
107 | |
108 | |
109 | #if (!defined __timespec_defined \ |
110 | && ((defined _TIME_H \ |
111 | && (defined __USE_POSIX199309 \ |
112 | || defined __USE_ISOC11)) \ |
113 | || defined __need_timespec)) |
114 | # define __timespec_defined 1 |
115 | |
116 | # include <bits/types.h> |
117 | |
118 | |
119 | |
120 | struct timespec |
121 | { |
122 | __time_t tv_sec; |
123 | __syscall_slong_t tv_nsec; |
124 | }; |
125 | |
126 | #endif |
127 | #undef __need_timespec |
128 | |
129 | |
130 | #ifdef _TIME_H |
131 | __BEGIN_NAMESPACE_STD |
132 | |
133 | struct tm |
134 | { |
135 | int tm_sec; |
136 | int tm_min; |
137 | int tm_hour; |
138 | int tm_mday; |
139 | int tm_mon; |
140 | int tm_year; |
141 | int tm_wday; |
142 | int tm_yday; |
143 | int tm_isdst; |
144 | |
145 | # ifdef __USE_MISC |
146 | long int tm_gmtoff; |
147 | const char *tm_zone; |
148 | # else |
149 | long int __tm_gmtoff; |
150 | const char *__tm_zone; |
151 | # endif |
152 | }; |
153 | __END_NAMESPACE_STD |
154 | #if defined __USE_XOPEN || defined __USE_POSIX |
155 | __USING_NAMESPACE_STD(tm) |
156 | #endif |
157 | |
158 | |
159 | # ifdef __USE_POSIX199309 |
160 | |
161 | struct itimerspec |
162 | { |
163 | struct timespec it_interval; |
164 | struct timespec it_value; |
165 | }; |
166 | |
167 | |
168 | struct sigevent; |
169 | |
170 | # endif |
171 | |
172 | # ifdef __USE_XOPEN2K |
173 | # ifndef __pid_t_defined |
174 | typedef __pid_t pid_t; |
175 | # define __pid_t_defined |
176 | # endif |
177 | # endif |
178 | |
179 | |
180 | # ifdef __USE_ISOC11 |
181 | |
182 | # define TIME_UTC 1 |
183 | # endif |
184 | |
185 | |
186 | __BEGIN_NAMESPACE_STD |
187 | |
188 | |
189 | extern clock_t clock (void) __THROW; |
190 | |
191 | |
192 | extern time_t time (time_t *__timer) __THROW; |
193 | |
194 | |
195 | extern double difftime (time_t __time1, time_t __time0) |
196 | __THROW __attribute__ ((__const__)); |
197 | |
198 | |
199 | extern time_t mktime (struct tm *__tp) __THROW; |
200 | |
201 | |
202 | |
203 | |
204 | |
205 | extern size_t strftime (char *__restrict __s, size_t __maxsize, |
206 | const char *__restrict __format, |
207 | const struct tm *__restrict __tp) __THROW; |
208 | __END_NAMESPACE_STD |
209 | |
210 | # ifdef __USE_XOPEN |
211 | |
212 | |
213 | extern char *strptime (const char *__restrict __s, |
214 | const char *__restrict __fmt, struct tm *__tp) |
215 | __THROW; |
216 | # endif |
217 | |
218 | # ifdef __USE_XOPEN2K8 |
219 | |
220 | |
221 | # include <xlocale.h> |
222 | |
223 | extern size_t strftime_l (char *__restrict __s, size_t __maxsize, |
224 | const char *__restrict __format, |
225 | const struct tm *__restrict __tp, |
226 | __locale_t __loc) __THROW; |
227 | # endif |
228 | |
229 | # ifdef __USE_GNU |
230 | extern char *strptime_l (const char *__restrict __s, |
231 | const char *__restrict __fmt, struct tm *__tp, |
232 | __locale_t __loc) __THROW; |
233 | # endif |
234 | |
235 | |
236 | __BEGIN_NAMESPACE_STD |
237 | |
238 | |
239 | extern struct tm *gmtime (const time_t *__timer) __THROW; |
240 | |
241 | |
242 | |
243 | extern struct tm *localtime (const time_t *__timer) __THROW; |
244 | __END_NAMESPACE_STD |
245 | |
246 | # ifdef __USE_POSIX |
247 | |
248 | |
249 | extern struct tm *gmtime_r (const time_t *__restrict __timer, |
250 | struct tm *__restrict __tp) __THROW; |
251 | |
252 | |
253 | |
254 | extern struct tm *localtime_r (const time_t *__restrict __timer, |
255 | struct tm *__restrict __tp) __THROW; |
256 | # endif |
257 | |
258 | __BEGIN_NAMESPACE_STD |
259 | |
260 | |
261 | extern char *asctime (const struct tm *__tp) __THROW; |
262 | |
263 | |
264 | extern char *ctime (const time_t *__timer) __THROW; |
265 | __END_NAMESPACE_STD |
266 | |
267 | # ifdef __USE_POSIX |
268 | |
269 | |
270 | |
271 | |
272 | extern char *asctime_r (const struct tm *__restrict __tp, |
273 | char *__restrict __buf) __THROW; |
274 | |
275 | |
276 | extern char *ctime_r (const time_t *__restrict __timer, |
277 | char *__restrict __buf) __THROW; |
278 | # endif |
279 | |
280 | |
281 | |
282 | extern char *__tzname[2]; |
283 | extern int __daylight; |
284 | extern long int __timezone; |
285 | |
286 | |
287 | # ifdef __USE_POSIX |
288 | |
289 | extern char *tzname[2]; |
290 | |
291 | |
292 | |
293 | extern void tzset (void) __THROW; |
294 | # endif |
295 | |
296 | # if defined __USE_MISC || defined __USE_XOPEN |
297 | extern int daylight; |
298 | extern long int timezone; |
299 | # endif |
300 | |
301 | # ifdef __USE_MISC |
302 | |
303 | |
304 | extern int stime (const time_t *__when) __THROW; |
305 | # endif |
306 | |
307 | |
308 | |
309 | |
310 | # define __isleap(year) \ |
311 | ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0)) |
312 | |
313 | |
314 | # ifdef __USE_MISC |
315 | |
316 | |
317 | |
318 | |
319 | extern time_t timegm (struct tm *__tp) __THROW; |
320 | |
321 | |
322 | extern time_t timelocal (struct tm *__tp) __THROW; |
323 | |
324 | |
325 | extern int dysize (int __year) __THROW __attribute__ ((__const__)); |
326 | # endif |
327 | |
328 | |
329 | # ifdef __USE_POSIX199309 |
330 | |
331 | |
332 | |
333 | |
334 | extern int nanosleep (const struct timespec *__requested_time, |
335 | struct timespec *__remaining); |
336 | |
337 | |
338 | |
339 | extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __THROW; |
340 | |
341 | |
342 | extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __THROW; |
343 | |
344 | |
345 | extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) |
346 | __THROW; |
347 | |
348 | # ifdef __USE_XOPEN2K |
349 | |
350 | |
351 | |
352 | |
353 | extern int clock_nanosleep (clockid_t __clock_id, int __flags, |
354 | const struct timespec *__req, |
355 | struct timespec *__rem); |
356 | |
357 | |
358 | extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __THROW; |
359 | # endif |
360 | |
361 | |
362 | |
363 | extern int timer_create (clockid_t __clock_id, |
364 | struct sigevent *__restrict __evp, |
365 | timer_t *__restrict __timerid) __THROW; |
366 | |
367 | |
368 | extern int timer_delete (timer_t __timerid) __THROW; |
369 | |
370 | |
371 | extern int timer_settime (timer_t __timerid, int __flags, |
372 | const struct itimerspec *__restrict __value, |
373 | struct itimerspec *__restrict __ovalue) __THROW; |
374 | |
375 | |
376 | extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) |
377 | __THROW; |
378 | |
379 | |
380 | extern int timer_getoverrun (timer_t __timerid) __THROW; |
381 | # endif |
382 | |
383 | |
384 | # ifdef __USE_ISOC11 |
385 | |
386 | extern int timespec_get (struct timespec *__ts, int __base) |
387 | __THROW __nonnull ((1)); |
388 | # endif |
389 | |
390 | |
391 | # ifdef __USE_XOPEN_EXTENDED |
392 | |
393 | |
394 | |
395 | |
396 | |
397 | |
398 | |
399 | |
400 | |
401 | |
402 | |
403 | extern int getdate_err; |
404 | |
405 | |
406 | |
407 | |
408 | |
409 | |
410 | |
411 | |
412 | extern struct tm *getdate (const char *__string); |
413 | # endif |
414 | |
415 | # ifdef __USE_GNU |
416 | |
417 | |
418 | |
419 | |
420 | |
421 | |
422 | |
423 | |
424 | |
425 | |
426 | extern int getdate_r (const char *__restrict __string, |
427 | struct tm *__restrict __resbufp); |
428 | # endif |
429 | |
430 | __END_DECLS |
431 | |
432 | #endif |
433 | |
434 | #endif |
435 | |