1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #if __GNUC__ >= 3
19 @PRAGMA_SYSTEM_HEADER@
20 #endif
21 @PRAGMA_COLUMNS@
22
23
24
25
26 #if !_GL_CONFIG_H_INCLUDED
27 #error "Please include config.h first."
28 #endif
29
30
31
32
33
34
35
36 #if (((defined __need_time_t || defined __need_clock_t \
37 || defined __need_timespec) \
38 && !defined __MINGW32__) \
39 || defined _@GUARD_PREFIX@_TIME_H)
40
41 # @INCLUDE_NEXT@ @NEXT_TIME_H@
42
43 #else
44
45 # define _@GUARD_PREFIX@_TIME_H
46
47
48
49 # if defined __MINGW32__
50 # include <unistd.h>
51 # endif
52
53 # @INCLUDE_NEXT@ @NEXT_TIME_H@
54
55
56
57 # if !_GL_CONFIG_H_INCLUDED
58 # error "Please include config.h first."
59 # endif
60
61
62 # include <stddef.h>
63
64
65
66
67
68
69
70
71
72
73
74 # if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@
75 # if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
76 # include <sys/time.h>
77 # elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@
78 # include <pthread.h>
79 # elif @UNISTD_H_DEFINES_STRUCT_TIMESPEC@
80 # include <unistd.h>
81 # else
82
83 # ifdef __cplusplus
84 extern "C" {
85 # endif
86
87 # if !GNULIB_defined_struct_timespec
88 # undef timespec
89 # define timespec rpl_timespec
90 struct timespec
91 {
92 time_t tv_sec;
93 long int tv_nsec;
94 };
95 # define GNULIB_defined_struct_timespec 1
96 # endif
97
98 # ifdef __cplusplus
99 }
100 # endif
101
102 # endif
103 # endif
104
105 # if !GNULIB_defined_struct_time_t_must_be_integral
106
107
108
109
110
111 struct __time_t_must_be_integral {
112 unsigned int __floating_time_t_unsupported : (time_t) 1;
113 };
114 # define GNULIB_defined_struct_time_t_must_be_integral 1
115 # endif
116
117
118 # if ! @TIME_H_DEFINES_TIME_UTC@
119 # if !GNULIB_defined_TIME_UTC
120 # define TIME_UTC 1
121 # define GNULIB_defined_TIME_UTC 1
122 # endif
123 # endif
124
125
126
127 # if @GNULIB_TIMESPEC_GET@
128 # if @REPLACE_TIMESPEC_GET@
129 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
130 # undef timespec_get
131 # define timespec_get rpl_timespec_get
132 # endif
133 _GL_FUNCDECL_RPL (timespec_get, int, (struct timespec *ts, int base)
134 _GL_ARG_NONNULL ((1)));
135 _GL_CXXALIAS_RPL (timespec_get, int, (struct timespec *ts, int base));
136 # else
137 # if !@HAVE_TIMESPEC_GET@
138 _GL_FUNCDECL_SYS (timespec_get, int, (struct timespec *ts, int base)
139 _GL_ARG_NONNULL ((1)));
140 # endif
141 _GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, int base));
142 # endif
143 # if __GLIBC__ >= 2
144 _GL_CXXALIASWARN (timespec_get);
145 # endif
146 # elif defined GNULIB_POSIXCHECK
147 # undef timespec_get
148 # if HAVE_RAW_DECL_TIMESPEC_GET
149 _GL_WARN_ON_USE (timespec_get, "timespec_get is unportable - "
150 "use gnulib module timespec_get for portability");
151 # endif
152 # endif
153
154
155
156 # if @GNULIB_TIMESPEC_GETRES@
157 # if ! @HAVE_TIMESPEC_GETRES@
158 _GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base)
159 _GL_ARG_NONNULL ((1)));
160 # endif
161 _GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base));
162 _GL_CXXALIASWARN (timespec_getres);
163 # elif defined GNULIB_POSIXCHECK
164 # undef timespec_getres
165 # if HAVE_RAW_DECL_TIMESPEC_GETRES
166 _GL_WARN_ON_USE (timespec_getres, "timespec_getres is unportable - "
167 "use gnulib module timespec_getres for portability");
168 # endif
169 # endif
170
171
172 # if @GNULIB_TIME@
173 # if @REPLACE_TIME@
174 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
175 # define time rpl_time
176 # endif
177 _GL_FUNCDECL_RPL (time, time_t, (time_t *__tp));
178 _GL_CXXALIAS_RPL (time, time_t, (time_t *__tp));
179 # else
180 _GL_CXXALIAS_SYS (time, time_t, (time_t *__tp));
181 # endif
182 # if __GLIBC__ >= 2
183 _GL_CXXALIASWARN (time);
184 # endif
185 # elif defined GNULIB_POSIXCHECK
186 # undef time
187 # if HAVE_RAW_DECL_TIME
188 _GL_WARN_ON_USE (time, "time has consistency problems - "
189 "use gnulib module time for portability");
190 # endif
191 # endif
192
193
194
195
196 # if @GNULIB_NANOSLEEP@
197 # if @REPLACE_NANOSLEEP@
198 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
199 # define nanosleep rpl_nanosleep
200 # endif
201 _GL_FUNCDECL_RPL (nanosleep, int,
202 (struct timespec const *__rqtp, struct timespec *__rmtp)
203 _GL_ARG_NONNULL ((1)));
204 _GL_CXXALIAS_RPL (nanosleep, int,
205 (struct timespec const *__rqtp, struct timespec *__rmtp));
206 # else
207 # if ! @HAVE_NANOSLEEP@
208 _GL_FUNCDECL_SYS (nanosleep, int,
209 (struct timespec const *__rqtp, struct timespec *__rmtp)
210 _GL_ARG_NONNULL ((1)));
211 # endif
212 _GL_CXXALIAS_SYS (nanosleep, int,
213 (struct timespec const *__rqtp, struct timespec *__rmtp));
214 # endif
215 _GL_CXXALIASWARN (nanosleep);
216 # elif defined GNULIB_POSIXCHECK
217 # undef nanosleep
218 # if HAVE_RAW_DECL_NANOSLEEP
219 _GL_WARN_ON_USE (nanosleep, "nanosleep is unportable - "
220 "use gnulib module nanosleep for portability");
221 # endif
222 # endif
223
224
225 # if @GNULIB_TZSET@
226 # if @REPLACE_TZSET@
227 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
228 # undef tzset
229 # define tzset rpl_tzset
230 # endif
231 _GL_FUNCDECL_RPL (tzset, void, (void));
232 _GL_CXXALIAS_RPL (tzset, void, (void));
233 # elif defined _WIN32 && !defined __CYGWIN__
234 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
235 # undef tzset
236 # define tzset _tzset
237 # endif
238 _GL_CXXALIAS_MDA (tzset, void, (void));
239 # else
240 _GL_CXXALIAS_SYS (tzset, void, (void));
241 # endif
242 _GL_CXXALIASWARN (tzset);
243 # elif @GNULIB_MDA_TZSET@
244
245
246
247 # if defined _WIN32 && !defined __CYGWIN__
248 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
249 # undef tzset
250 # define tzset _tzset
251 # endif
252 _GL_CXXALIAS_MDA (tzset, void, (void));
253 # else
254 _GL_CXXALIAS_SYS (tzset, void, (void));
255 # endif
256 _GL_CXXALIASWARN (tzset);
257 # elif defined GNULIB_POSIXCHECK
258 # undef tzset
259 # if HAVE_RAW_DECL_TZSET
260 _GL_WARN_ON_USE (tzset, "tzset has portability problems - "
261 "use gnulib module tzset for portability");
262 # endif
263 # endif
264
265
266 # if @GNULIB_MKTIME@
267 # if @REPLACE_MKTIME@
268 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
269 # define mktime rpl_mktime
270 # endif
271 _GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1)));
272 _GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp));
273 # else
274 _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp));
275 # endif
276 # if __GLIBC__ >= 2
277 _GL_CXXALIASWARN (mktime);
278 # endif
279 # elif defined GNULIB_POSIXCHECK
280 # undef mktime
281 # if HAVE_RAW_DECL_MKTIME
282 _GL_WARN_ON_USE (mktime, "mktime has portability problems - "
283 "use gnulib module mktime for portability");
284 # endif
285 # endif
286
287
288
289
290 # if @GNULIB_TIME_R@
291 # if @REPLACE_LOCALTIME_R@
292 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
293 # undef localtime_r
294 # define localtime_r rpl_localtime_r
295 # endif
296 _GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
297 struct tm *restrict __result)
298 _GL_ARG_NONNULL ((1, 2)));
299 _GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
300 struct tm *restrict __result));
301 # else
302 # if ! @HAVE_DECL_LOCALTIME_R@
303 _GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
304 struct tm *restrict __result)
305 _GL_ARG_NONNULL ((1, 2)));
306 # endif
307 _GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
308 struct tm *restrict __result));
309 # endif
310 # if @HAVE_DECL_LOCALTIME_R@
311 _GL_CXXALIASWARN (localtime_r);
312 # endif
313 # if @REPLACE_LOCALTIME_R@
314 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
315 # undef gmtime_r
316 # define gmtime_r rpl_gmtime_r
317 # endif
318 _GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
319 struct tm *restrict __result)
320 _GL_ARG_NONNULL ((1, 2)));
321 _GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
322 struct tm *restrict __result));
323 # else
324 # if ! @HAVE_DECL_LOCALTIME_R@
325 _GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
326 struct tm *restrict __result)
327 _GL_ARG_NONNULL ((1, 2)));
328 # endif
329 _GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
330 struct tm *restrict __result));
331 # endif
332 # if @HAVE_DECL_LOCALTIME_R@
333 _GL_CXXALIASWARN (gmtime_r);
334 # endif
335 # elif defined GNULIB_POSIXCHECK
336 # undef localtime_r
337 # if HAVE_RAW_DECL_LOCALTIME_R
338 _GL_WARN_ON_USE (localtime_r, "localtime_r is unportable - "
339 "use gnulib module time_r for portability");
340 # endif
341 # undef gmtime_r
342 # if HAVE_RAW_DECL_GMTIME_R
343 _GL_WARN_ON_USE (gmtime_r, "gmtime_r is unportable - "
344 "use gnulib module time_r for portability");
345 # endif
346 # endif
347
348
349
350
351 # if @GNULIB_LOCALTIME@ || @REPLACE_LOCALTIME@
352 # if @REPLACE_LOCALTIME@
353 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
354 # undef localtime
355 # define localtime rpl_localtime
356 # endif
357 _GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer)
358 _GL_ARG_NONNULL ((1)));
359 _GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer));
360 # else
361 _GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer));
362 # endif
363 # if __GLIBC__ >= 2
364 _GL_CXXALIASWARN (localtime);
365 # endif
366 # elif defined GNULIB_POSIXCHECK
367 # undef localtime
368 # if HAVE_RAW_DECL_LOCALTIME
369 _GL_WARN_ON_USE (localtime, "localtime has portability problems - "
370 "use gnulib module localtime for portability");
371 # endif
372 # endif
373
374 # if 0 || @REPLACE_GMTIME@
375 # if @REPLACE_GMTIME@
376 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
377 # undef gmtime
378 # define gmtime rpl_gmtime
379 # endif
380 _GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer)
381 _GL_ARG_NONNULL ((1)));
382 _GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer));
383 # else
384 _GL_CXXALIAS_SYS (gmtime, struct tm *, (time_t const *__timer));
385 # endif
386 _GL_CXXALIASWARN (gmtime);
387 # endif
388
389
390
391
392 # if @GNULIB_STRPTIME@
393 # if ! @HAVE_STRPTIME@
394 _GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf,
395 char const *restrict __format,
396 struct tm *restrict __tm)
397 _GL_ARG_NONNULL ((1, 2, 3)));
398 # endif
399 _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf,
400 char const *restrict __format,
401 struct tm *restrict __tm));
402 _GL_CXXALIASWARN (strptime);
403 # elif defined GNULIB_POSIXCHECK
404 # undef strptime
405 # if HAVE_RAW_DECL_STRPTIME
406 _GL_WARN_ON_USE (strptime, "strptime is unportable - "
407 "use gnulib module strptime for portability");
408 # endif
409 # endif
410
411
412
413 # if @GNULIB_CTIME@
414 # if @REPLACE_CTIME@
415 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
416 # define ctime rpl_ctime
417 # endif
418 # ifndef __cplusplus
419 _GL_ATTRIBUTE_DEPRECATED
420 # endif
421 _GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp)
422 _GL_ARG_NONNULL ((1)));
423 _GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp));
424 # else
425 _GL_CXXALIAS_SYS (ctime, char *, (time_t const *__tp));
426 # endif
427 # if __GLIBC__ >= 2
428 _GL_CXXALIASWARN (ctime);
429 # endif
430 # elif defined GNULIB_POSIXCHECK
431 # undef ctime
432 # if HAVE_RAW_DECL_CTIME
433 _GL_WARN_ON_USE (ctime, "ctime has portability problems - "
434 "use gnulib module ctime for portability");
435 # endif
436 # endif
437
438
439
440 # if @GNULIB_STRFTIME@
441 # if @REPLACE_STRFTIME@
442 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
443 # define strftime rpl_strftime
444 # endif
445 _GL_FUNCDECL_RPL (strftime, size_t,
446 (char *restrict __buf, size_t __bufsize,
447 const char *restrict __fmt, const struct tm *restrict __tp)
448 _GL_ARG_NONNULL ((1, 3, 4)));
449 _GL_CXXALIAS_RPL (strftime, size_t,
450 (char *restrict __buf, size_t __bufsize,
451 const char *restrict __fmt, const struct tm *restrict __tp));
452 # else
453 _GL_CXXALIAS_SYS (strftime, size_t,
454 (char *restrict __buf, size_t __bufsize,
455 const char *restrict __fmt, const struct tm *restrict __tp));
456 # endif
457 # if __GLIBC__ >= 2
458 _GL_CXXALIASWARN (strftime);
459 # endif
460 # elif defined GNULIB_POSIXCHECK
461 # undef strftime
462 # if HAVE_RAW_DECL_STRFTIME
463 _GL_WARN_ON_USE (strftime, "strftime has portability problems - "
464 "use gnulib module strftime-fixes for portability");
465 # endif
466 # endif
467
468 # if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@
469
470
471
472
473
474
475 typedef struct tm_zone *timezone_t;
476
477
478
479
480
481
482
483
484
485 _GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name));
486 _GL_CXXALIAS_SYS (tzalloc, timezone_t, (char const *__name));
487
488
489
490
491 _GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz));
492 _GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz));
493
494
495
496
497
498
499 _GL_FUNCDECL_SYS (localtime_rz, struct tm *,
500 (timezone_t __tz, time_t const *restrict __timer,
501 struct tm *restrict __result) _GL_ARG_NONNULL ((2, 3)));
502 _GL_CXXALIAS_SYS (localtime_rz, struct tm *,
503 (timezone_t __tz, time_t const *restrict __timer,
504 struct tm *restrict __result));
505
506
507
508
509
510
511 _GL_FUNCDECL_SYS (mktime_z, time_t,
512 (timezone_t __tz, struct tm *restrict __tm)
513 _GL_ARG_NONNULL ((2)));
514 _GL_CXXALIAS_SYS (mktime_z, time_t,
515 (timezone_t __tz, struct tm *restrict __tm));
516
517
518
519
520
521
522
523 # endif
524
525
526 # if @GNULIB_TIMEGM@
527 # if @REPLACE_TIMEGM@
528 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
529 # undef timegm
530 # define timegm rpl_timegm
531 # endif
532 _GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
533 _GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm));
534 # else
535 # if ! @HAVE_TIMEGM@
536 _GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
537 # endif
538 _GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm));
539 # endif
540 # if __GLIBC__ >= 2
541 _GL_CXXALIASWARN (timegm);
542 # endif
543 # elif defined GNULIB_POSIXCHECK
544 # undef timegm
545 # if HAVE_RAW_DECL_TIMEGM
546 _GL_WARN_ON_USE (timegm, "timegm is unportable - "
547 "use gnulib module timegm for portability");
548 # endif
549 # endif
550
551
552
553
554 # if defined GNULIB_POSIXCHECK
555 # undef asctime
556 # if HAVE_RAW_DECL_ASCTIME
557 _GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - "
558 "better use strftime (or even sprintf) instead");
559 # endif
560 # endif
561 # if defined GNULIB_POSIXCHECK
562 # undef asctime_r
563 # if HAVE_RAW_DECL_ASCTIME_R
564 _GL_WARN_ON_USE (asctime_r, "asctime_r can overrun buffers in some cases - "
565 "better use strftime (or even sprintf) instead");
566 # endif
567 # endif
568 # if defined GNULIB_POSIXCHECK
569 # undef ctime
570 # if HAVE_RAW_DECL_CTIME
571 _GL_WARN_ON_USE (ctime, "ctime can overrun buffers in some cases - "
572 "better use strftime (or even sprintf) instead");
573 # endif
574 # endif
575 # if defined GNULIB_POSIXCHECK
576 # undef ctime_r
577 # if HAVE_RAW_DECL_CTIME_R
578 _GL_WARN_ON_USE (ctime_r, "ctime_r can overrun buffers in some cases - "
579 "better use strftime (or even sprintf) instead");
580 # endif
581 # endif
582
583 #endif