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 # endif
147
148
149
150 # if @GNULIB_TIMESPEC_GETRES@
151 # if ! @HAVE_TIMESPEC_GETRES@
152 _GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base)
153 _GL_ARG_NONNULL ((1)));
154 # endif
155 _GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base));
156 _GL_CXXALIASWARN (timespec_getres);
157 # endif
158
159
160 # if @GNULIB_TIME@
161 # if @REPLACE_TIME@
162 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
163 # define time rpl_time
164 # endif
165 _GL_FUNCDECL_RPL (time, time_t, (time_t *__tp));
166 _GL_CXXALIAS_RPL (time, time_t, (time_t *__tp));
167 # else
168 _GL_CXXALIAS_SYS (time, time_t, (time_t *__tp));
169 # endif
170 # if __GLIBC__ >= 2
171 _GL_CXXALIASWARN (time);
172 # endif
173 # endif
174
175
176
177
178 # if @GNULIB_NANOSLEEP@
179 # if @REPLACE_NANOSLEEP@
180 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
181 # define nanosleep rpl_nanosleep
182 # endif
183 _GL_FUNCDECL_RPL (nanosleep, int,
184 (struct timespec const *__rqtp, struct timespec *__rmtp)
185 _GL_ARG_NONNULL ((1)));
186 _GL_CXXALIAS_RPL (nanosleep, int,
187 (struct timespec const *__rqtp, struct timespec *__rmtp));
188 # else
189 # if ! @HAVE_NANOSLEEP@
190 _GL_FUNCDECL_SYS (nanosleep, int,
191 (struct timespec const *__rqtp, struct timespec *__rmtp)
192 _GL_ARG_NONNULL ((1)));
193 # endif
194 _GL_CXXALIAS_SYS (nanosleep, int,
195 (struct timespec const *__rqtp, struct timespec *__rmtp));
196 # endif
197 _GL_CXXALIASWARN (nanosleep);
198 # endif
199
200
201 # if @GNULIB_TZSET@
202 # if @REPLACE_TZSET@
203 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
204 # undef tzset
205 # define tzset rpl_tzset
206 # endif
207 _GL_FUNCDECL_RPL (tzset, void, (void));
208 _GL_CXXALIAS_RPL (tzset, void, (void));
209 # elif defined _WIN32 && !defined __CYGWIN__
210 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
211 # undef tzset
212 # define tzset _tzset
213 # endif
214 _GL_CXXALIAS_MDA (tzset, void, (void));
215 # else
216 _GL_CXXALIAS_SYS (tzset, void, (void));
217 # endif
218 _GL_CXXALIASWARN (tzset);
219 # elif @GNULIB_MDA_TZSET@
220
221
222
223 # if defined _WIN32 && !defined __CYGWIN__
224 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
225 # undef tzset
226 # define tzset _tzset
227 # endif
228 _GL_CXXALIAS_MDA (tzset, void, (void));
229 # else
230 _GL_CXXALIAS_SYS (tzset, void, (void));
231 # endif
232 _GL_CXXALIASWARN (tzset);
233 # endif
234
235
236 # if @GNULIB_MKTIME@
237 # if @REPLACE_MKTIME@
238 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
239 # define mktime rpl_mktime
240 # endif
241 _GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1)));
242 _GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp));
243 # else
244 _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp));
245 # endif
246 # if __GLIBC__ >= 2
247 _GL_CXXALIASWARN (mktime);
248 # endif
249 # endif
250
251
252
253
254 # if @GNULIB_TIME_R@
255 # if @REPLACE_LOCALTIME_R@
256 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
257 # undef localtime_r
258 # define localtime_r rpl_localtime_r
259 # endif
260 _GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
261 struct tm *restrict __result)
262 _GL_ARG_NONNULL ((1, 2)));
263 _GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
264 struct tm *restrict __result));
265 # else
266 # if ! @HAVE_DECL_LOCALTIME_R@
267 _GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
268 struct tm *restrict __result)
269 _GL_ARG_NONNULL ((1, 2)));
270 # endif
271 _GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
272 struct tm *restrict __result));
273 # endif
274 # if @HAVE_DECL_LOCALTIME_R@
275 _GL_CXXALIASWARN (localtime_r);
276 # endif
277 # if @REPLACE_LOCALTIME_R@
278 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
279 # undef gmtime_r
280 # define gmtime_r rpl_gmtime_r
281 # endif
282 _GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
283 struct tm *restrict __result)
284 _GL_ARG_NONNULL ((1, 2)));
285 _GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
286 struct tm *restrict __result));
287 # else
288 # if ! @HAVE_DECL_LOCALTIME_R@
289 _GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
290 struct tm *restrict __result)
291 _GL_ARG_NONNULL ((1, 2)));
292 # endif
293 _GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
294 struct tm *restrict __result));
295 # endif
296 # if @HAVE_DECL_LOCALTIME_R@
297 _GL_CXXALIASWARN (gmtime_r);
298 # endif
299 # endif
300
301
302
303
304 # if @GNULIB_LOCALTIME@ || @REPLACE_LOCALTIME@
305 # if @REPLACE_LOCALTIME@
306 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
307 # undef localtime
308 # define localtime rpl_localtime
309 # endif
310 _GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer)
311 _GL_ARG_NONNULL ((1)));
312 _GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer));
313 # else
314 _GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer));
315 # endif
316 # if __GLIBC__ >= 2
317 _GL_CXXALIASWARN (localtime);
318 # endif
319 # endif
320
321 # if 0 || @REPLACE_GMTIME@
322 # if @REPLACE_GMTIME@
323 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
324 # undef gmtime
325 # define gmtime rpl_gmtime
326 # endif
327 _GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer)
328 _GL_ARG_NONNULL ((1)));
329 _GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer));
330 # else
331 _GL_CXXALIAS_SYS (gmtime, struct tm *, (time_t const *__timer));
332 # endif
333 _GL_CXXALIASWARN (gmtime);
334 # endif
335
336
337
338
339 # if @GNULIB_STRPTIME@
340 # if ! @HAVE_STRPTIME@
341 _GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf,
342 char const *restrict __format,
343 struct tm *restrict __tm)
344 _GL_ARG_NONNULL ((1, 2, 3)));
345 # endif
346 _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf,
347 char const *restrict __format,
348 struct tm *restrict __tm));
349 _GL_CXXALIASWARN (strptime);
350 # endif
351
352
353
354 # if @GNULIB_CTIME@
355 # if @REPLACE_CTIME@
356 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
357 # define ctime rpl_ctime
358 # endif
359 # ifndef __cplusplus
360 _GL_ATTRIBUTE_DEPRECATED
361 # endif
362 _GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp)
363 _GL_ARG_NONNULL ((1)));
364 _GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp));
365 # else
366 _GL_CXXALIAS_SYS (ctime, char *, (time_t const *__tp));
367 # endif
368 # if __GLIBC__ >= 2
369 _GL_CXXALIASWARN (ctime);
370 # endif
371 # endif
372
373
374
375 # if @GNULIB_STRFTIME@
376 # if @REPLACE_STRFTIME@
377 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
378 # define strftime rpl_strftime
379 # endif
380 _GL_FUNCDECL_RPL (strftime, size_t,
381 (char *restrict __buf, size_t __bufsize,
382 const char *restrict __fmt, const struct tm *restrict __tp)
383 _GL_ARG_NONNULL ((1, 3, 4)));
384 _GL_CXXALIAS_RPL (strftime, size_t,
385 (char *restrict __buf, size_t __bufsize,
386 const char *restrict __fmt, const struct tm *restrict __tp));
387 # else
388 _GL_CXXALIAS_SYS (strftime, size_t,
389 (char *restrict __buf, size_t __bufsize,
390 const char *restrict __fmt, const struct tm *restrict __tp));
391 # endif
392 # if __GLIBC__ >= 2
393 _GL_CXXALIASWARN (strftime);
394 # endif
395 # endif
396
397 # if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@
398
399
400
401
402
403
404 typedef struct tm_zone *timezone_t;
405
406
407
408
409
410
411
412
413
414 _GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name));
415 _GL_CXXALIAS_SYS (tzalloc, timezone_t, (char const *__name));
416
417
418
419
420 _GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz));
421 _GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz));
422
423
424
425
426
427
428 _GL_FUNCDECL_SYS (localtime_rz, struct tm *,
429 (timezone_t __tz, time_t const *restrict __timer,
430 struct tm *restrict __result) _GL_ARG_NONNULL ((2, 3)));
431 _GL_CXXALIAS_SYS (localtime_rz, struct tm *,
432 (timezone_t __tz, time_t const *restrict __timer,
433 struct tm *restrict __result));
434
435
436
437
438
439
440 _GL_FUNCDECL_SYS (mktime_z, time_t,
441 (timezone_t __tz, struct tm *restrict __tm)
442 _GL_ARG_NONNULL ((2)));
443 _GL_CXXALIAS_SYS (mktime_z, time_t,
444 (timezone_t __tz, struct tm *restrict __tm));
445
446
447
448
449
450
451
452 # endif
453
454
455 # if @GNULIB_TIMEGM@
456 # if @REPLACE_TIMEGM@
457 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
458 # undef timegm
459 # define timegm rpl_timegm
460 # endif
461 _GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
462 _GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm));
463 # else
464 # if ! @HAVE_TIMEGM@
465 _GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
466 # endif
467 _GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm));
468 # endif
469 # if __GLIBC__ >= 2
470 _GL_CXXALIASWARN (timegm);
471 # endif
472 # endif
473
474
475
476
477 # if defined GNULIB_POSIXCHECK
478 # undef asctime
479 _GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - "
480 "better use strftime (or even sprintf) instead");
481 # endif
482 # if defined GNULIB_POSIXCHECK
483 # undef asctime_r
484 # if HAVE_RAW_DECL_ASCTIME_R
485 _GL_WARN_ON_USE (asctime_r, "asctime_r can overrun buffers in some cases - "
486 "better use strftime (or even sprintf) instead");
487 # endif
488 # endif
489 # if defined GNULIB_POSIXCHECK
490 # undef ctime
491 _GL_WARN_ON_USE (ctime, "ctime can overrun buffers in some cases - "
492 "better use strftime (or even sprintf) instead");
493 # endif
494 # if defined GNULIB_POSIXCHECK
495 # undef ctime_r
496 # if HAVE_RAW_DECL_CTIME_R
497 _GL_WARN_ON_USE (ctime_r, "ctime_r can overrun buffers in some cases - "
498 "better use strftime (or even sprintf) instead");
499 # endif
500 # endif
501
502 #endif