1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* A more-standard <time.h>.
4 Copyright (C) 2007-2019 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, see <https://www.gnu.org/licenses/>. */
20 #pragma GCC system_header
24 /* Don't get in the way of glibc when it includes time.h merely to
25 declare a few standard symbols, rather than to declare all the
26 symbols. (However, skip this for MinGW as it treats __need_time_t
27 incompatibly.) Also, Solaris 8 <time.h> eventually includes itself
28 recursively; if that is happening, just include the system <time.h>
29 without adding our own declarations. */
30 #if (((defined __need_time_t || defined __need_clock_t \
31 || defined __need_timespec) \
32 && !defined __MINGW32__) \
33 || defined _GL_TIME_H)
35 # include_next <time.h>
41 # include_next <time.h>
43 /* NetBSD 5.0 mis-defines NULL. */
46 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
47 /* C++ compatible function declaration macros.
48 Copyright (C) 2010-2019 Free Software Foundation, Inc.
50 This program is free software: you can redistribute it and/or modify it
51 under the terms of the GNU General Public License as published
52 by the Free Software Foundation; either version 3 of the License, or
53 (at your option) any later version.
55 This program is distributed in the hope that it will be useful,
56 but WITHOUT ANY WARRANTY; without even the implied warranty of
57 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
58 General Public License for more details.
60 You should have received a copy of the GNU General Public License
61 along with this program. If not, see <https://www.gnu.org/licenses/>. */
66 /* Begin/end the GNULIB_NAMESPACE namespace. */
67 #if defined __cplusplus && defined GNULIB_NAMESPACE
68 # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
69 # define _GL_END_NAMESPACE }
71 # define _GL_BEGIN_NAMESPACE
72 # define _GL_END_NAMESPACE
75 /* The three most frequent use cases of these macros are:
77 * For providing a substitute for a function that is missing on some
78 platforms, but is declared and works fine on the platforms on which
83 _GL_FUNCDECL_SYS (foo, ...);
85 _GL_CXXALIAS_SYS (foo, ...);
86 _GL_CXXALIASWARN (foo);
87 #elif defined GNULIB_POSIXCHECK
91 * For providing a replacement for a function that exists on all platforms,
92 but is broken/insufficient and needs to be replaced on some platforms:
96 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
100 _GL_FUNCDECL_RPL (foo, ...);
101 _GL_CXXALIAS_RPL (foo, ...);
103 _GL_CXXALIAS_SYS (foo, ...);
105 _GL_CXXALIASWARN (foo);
106 #elif defined GNULIB_POSIXCHECK
110 * For providing a replacement for a function that exists on some platforms
111 but is broken/insufficient and needs to be replaced on some of them and
112 is additionally either missing or undeclared on some other platforms:
116 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
120 _GL_FUNCDECL_RPL (foo, ...);
121 _GL_CXXALIAS_RPL (foo, ...);
123 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
124 _GL_FUNCDECL_SYS (foo, ...);
126 _GL_CXXALIAS_SYS (foo, ...);
128 _GL_CXXALIASWARN (foo);
129 #elif defined GNULIB_POSIXCHECK
134 /* _GL_EXTERN_C declaration;
135 performs the declaration with C linkage. */
136 #if defined __cplusplus
137 # define _GL_EXTERN_C extern "C"
139 # define _GL_EXTERN_C extern
142 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
143 declares a replacement function, named rpl_func, with the given prototype,
144 consisting of return type, parameters, and attributes.
146 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
147 _GL_ARG_NONNULL ((1)));
149 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
150 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
151 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
152 _GL_EXTERN_C rettype rpl_func parameters_and_attributes
154 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
155 declares the system function, named func, with the given prototype,
156 consisting of return type, parameters, and attributes.
158 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
159 _GL_ARG_NONNULL ((1)));
161 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
162 _GL_EXTERN_C rettype func parameters_and_attributes
164 /* _GL_CXXALIAS_RPL (func, rettype, parameters);
165 declares a C++ alias called GNULIB_NAMESPACE::func
166 that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
168 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
170 Wrapping rpl_func in an object with an inline conversion operator
171 avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
172 actually used in the program. */
173 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
174 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
175 #if defined __cplusplus && defined GNULIB_NAMESPACE
176 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
177 namespace GNULIB_NAMESPACE \
179 static const struct _gl_ ## func ## _wrapper \
181 typedef rettype (*type) parameters; \
183 inline operator type () const \
189 _GL_EXTERN_C int _gl_cxxalias_dummy
191 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
192 _GL_EXTERN_C int _gl_cxxalias_dummy
195 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
196 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
197 except that the C function rpl_func may have a slightly different
198 declaration. A cast is used to silence the "invalid conversion" error
199 that would otherwise occur. */
200 #if defined __cplusplus && defined GNULIB_NAMESPACE
201 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
202 namespace GNULIB_NAMESPACE \
204 static const struct _gl_ ## func ## _wrapper \
206 typedef rettype (*type) parameters; \
208 inline operator type () const \
210 return reinterpret_cast<type>(::rpl_func); \
214 _GL_EXTERN_C int _gl_cxxalias_dummy
216 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
217 _GL_EXTERN_C int _gl_cxxalias_dummy
220 /* _GL_CXXALIAS_SYS (func, rettype, parameters);
221 declares a C++ alias called GNULIB_NAMESPACE::func
222 that redirects to the system provided function func, if GNULIB_NAMESPACE
225 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
227 Wrapping func in an object with an inline conversion operator
228 avoids a reference to func unless GNULIB_NAMESPACE::func is
229 actually used in the program. */
230 #if defined __cplusplus && defined GNULIB_NAMESPACE
231 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
232 namespace GNULIB_NAMESPACE \
234 static const struct _gl_ ## func ## _wrapper \
236 typedef rettype (*type) parameters; \
238 inline operator type () const \
244 _GL_EXTERN_C int _gl_cxxalias_dummy
246 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
247 _GL_EXTERN_C int _gl_cxxalias_dummy
250 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
251 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
252 except that the C function func may have a slightly different declaration.
253 A cast is used to silence the "invalid conversion" error that would
255 #if defined __cplusplus && defined GNULIB_NAMESPACE
256 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
257 namespace GNULIB_NAMESPACE \
259 static const struct _gl_ ## func ## _wrapper \
261 typedef rettype (*type) parameters; \
263 inline operator type () const \
265 return reinterpret_cast<type>(::func); \
269 _GL_EXTERN_C int _gl_cxxalias_dummy
271 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
272 _GL_EXTERN_C int _gl_cxxalias_dummy
275 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
276 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
277 except that the C function is picked among a set of overloaded functions,
278 namely the one with rettype2 and parameters2. Two consecutive casts
279 are used to silence the "cannot find a match" and "invalid conversion"
280 errors that would otherwise occur. */
281 #if defined __cplusplus && defined GNULIB_NAMESPACE
282 /* The outer cast must be a reinterpret_cast.
283 The inner cast: When the function is defined as a set of overloaded
284 functions, it works as a static_cast<>, choosing the designated variant.
285 When the function is defined as a single variant, it works as a
286 reinterpret_cast<>. The parenthesized cast syntax works both ways. */
287 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
288 namespace GNULIB_NAMESPACE \
290 static const struct _gl_ ## func ## _wrapper \
292 typedef rettype (*type) parameters; \
294 inline operator type () const \
296 return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \
300 _GL_EXTERN_C int _gl_cxxalias_dummy
302 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
303 _GL_EXTERN_C int _gl_cxxalias_dummy
306 /* _GL_CXXALIASWARN (func);
307 causes a warning to be emitted when ::func is used but not when
308 GNULIB_NAMESPACE::func is used. func must be defined without overloaded
310 #if defined __cplusplus && defined GNULIB_NAMESPACE
311 # define _GL_CXXALIASWARN(func) \
312 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
313 # define _GL_CXXALIASWARN_1(func,namespace) \
314 _GL_CXXALIASWARN_2 (func, namespace)
315 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
316 we enable the warning only when not optimizing. */
318 # define _GL_CXXALIASWARN_2(func,namespace) \
319 _GL_WARN_ON_USE (func, \
320 "The symbol ::" #func " refers to the system function. " \
321 "Use " #namespace "::" #func " instead.")
322 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
323 # define _GL_CXXALIASWARN_2(func,namespace) \
324 extern __typeof__ (func) func
326 # define _GL_CXXALIASWARN_2(func,namespace) \
327 _GL_EXTERN_C int _gl_cxxalias_dummy
330 # define _GL_CXXALIASWARN(func) \
331 _GL_EXTERN_C int _gl_cxxalias_dummy
334 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
335 causes a warning to be emitted when the given overloaded variant of ::func
336 is used but not when GNULIB_NAMESPACE::func is used. */
337 #if defined __cplusplus && defined GNULIB_NAMESPACE
338 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
339 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
341 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
342 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
343 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
344 we enable the warning only when not optimizing. */
346 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
347 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
348 "The symbol ::" #func " refers to the system function. " \
349 "Use " #namespace "::" #func " instead.")
350 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
351 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
352 extern __typeof__ (func) func
354 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
355 _GL_EXTERN_C int _gl_cxxalias_dummy
358 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
359 _GL_EXTERN_C int _gl_cxxalias_dummy
362 #endif /* _GL_CXXDEFS_H */
364 /* The definition of _GL_ARG_NONNULL is copied here. */
365 /* A C macro for declaring that specific arguments must not be NULL.
366 Copyright (C) 2009-2019 Free Software Foundation, Inc.
368 This program is free software: you can redistribute it and/or modify it
369 under the terms of the GNU General Public License as published
370 by the Free Software Foundation; either version 3 of the License, or
371 (at your option) any later version.
373 This program is distributed in the hope that it will be useful,
374 but WITHOUT ANY WARRANTY; without even the implied warranty of
375 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376 General Public License for more details.
378 You should have received a copy of the GNU General Public License
379 along with this program. If not, see <https://www.gnu.org/licenses/>. */
381 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
382 that the values passed as arguments n, ..., m must be non-NULL pointers.
383 n = 1 stands for the first argument, n = 2 for the second argument etc. */
384 #ifndef _GL_ARG_NONNULL
385 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
386 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
388 # define _GL_ARG_NONNULL(params)
392 /* The definition of _GL_WARN_ON_USE is copied here. */
393 /* A C macro for emitting warnings if a function is used.
394 Copyright (C) 2010-2019 Free Software Foundation, Inc.
396 This program is free software: you can redistribute it and/or modify it
397 under the terms of the GNU General Public License as published
398 by the Free Software Foundation; either version 3 of the License, or
399 (at your option) any later version.
401 This program is distributed in the hope that it will be useful,
402 but WITHOUT ANY WARRANTY; without even the implied warranty of
403 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
404 General Public License for more details.
406 You should have received a copy of the GNU General Public License
407 along with this program. If not, see <https://www.gnu.org/licenses/>. */
409 /* _GL_WARN_ON_USE (function, "literal string") issues a declaration
410 for FUNCTION which will then trigger a compiler warning containing
411 the text of "literal string" anywhere that function is called, if
412 supported by the compiler. If the compiler does not support this
413 feature, the macro expands to an unused extern declaration.
415 _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
416 attribute used in _GL_WARN_ON_USE. If the compiler does not support
417 this feature, it expands to empty.
419 These macros are useful for marking a function as a potential
420 portability trap, with the intent that "literal string" include
421 instructions on the replacement function that should be used
423 _GL_WARN_ON_USE is for functions with 'extern' linkage.
424 _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
427 However, one of the reasons that a function is a portability trap is
428 if it has the wrong signature. Declaring FUNCTION with a different
429 signature in C is a compilation error, so this macro must use the
430 same type as any existing declaration so that programs that avoid
431 the problematic FUNCTION do not fail to compile merely because they
432 included a header that poisoned the function. But this implies that
433 _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
434 have a declaration. Use of this macro implies that there must not
435 be any other macro hiding the declaration of FUNCTION; but
436 undefining FUNCTION first is part of the poisoning process anyway
437 (although for symbols that are provided only via a macro, the result
438 is a compilation error rather than a warning containing
439 "literal string"). Also note that in C++, it is only safe to use if
440 FUNCTION has no overloads.
442 For an example, it is possible to poison 'getline' by:
443 - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
444 [getline]) in configure.ac, which potentially defines
445 HAVE_RAW_DECL_GETLINE
446 - adding this code to a header that wraps the system <stdio.h>:
448 #if HAVE_RAW_DECL_GETLINE
449 _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
450 "not universally present; use the gnulib module getline");
453 It is not possible to directly poison global variables. But it is
454 possible to write a wrapper accessor function, and poison that
455 (less common usage, like &environ, will cause a compilation error
456 rather than issue the nice warning, but the end result of informing
457 the developer about their portability problem is still achieved):
458 #if HAVE_RAW_DECL_ENVIRON
460 rpl_environ (void) { return &environ; }
461 _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
463 # define environ (*rpl_environ ())
465 or better (avoiding contradictory use of 'static' and 'extern'):
466 #if HAVE_RAW_DECL_ENVIRON
468 _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
469 rpl_environ (void) { return &environ; }
471 # define environ (*rpl_environ ())
474 #ifndef _GL_WARN_ON_USE
476 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
477 /* A compiler attribute is available in gcc versions 4.3.0 and later. */
478 # define _GL_WARN_ON_USE(function, message) \
479 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
480 # define _GL_WARN_ON_USE_ATTRIBUTE(message) \
481 __attribute__ ((__warning__ (message)))
482 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
483 /* Verify the existence of the function. */
484 # define _GL_WARN_ON_USE(function, message) \
485 extern __typeof__ (function) function
486 # define _GL_WARN_ON_USE_ATTRIBUTE(message)
487 # else /* Unsupported. */
488 # define _GL_WARN_ON_USE(function, message) \
489 _GL_WARN_EXTERN_C int _gl_warn_on_use
490 # define _GL_WARN_ON_USE_ATTRIBUTE(message)
494 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
495 is like _GL_WARN_ON_USE (function, "string"), except that the function is
496 declared with the given prototype, consisting of return type, parameters,
498 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
499 not work in this case. */
500 #ifndef _GL_WARN_ON_USE_CXX
501 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
502 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
503 extern rettype function parameters_and_attributes \
504 __attribute__ ((__warning__ (msg)))
505 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
506 /* Verify the existence of the function. */
507 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
508 extern rettype function parameters_and_attributes
509 # else /* Unsupported. */
510 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
511 _GL_WARN_EXTERN_C int _gl_warn_on_use
515 /* _GL_WARN_EXTERN_C declaration;
516 performs the declaration with C linkage. */
517 #ifndef _GL_WARN_EXTERN_C
518 # if defined __cplusplus
519 # define _GL_WARN_EXTERN_C extern "C"
521 # define _GL_WARN_EXTERN_C extern
525 /* Some systems don't define struct timespec (e.g., AIX 4.1).
526 Or they define it with the wrong member names or define it in <sys/time.h>
527 (e.g., FreeBSD circa 1997). Stock Mingw prior to 3.0 does not define it,
528 but the pthreads-win32 library defines it in <pthread.h>. */
531 # include <sys/time.h>
533 # include <pthread.h>
542 # if !GNULIB_defined_struct_timespec
544 # define timespec rpl_timespec
550 # define GNULIB_defined_struct_timespec 1
560 # if !GNULIB_defined_struct_time_t_must_be_integral
561 /* Per http://austingroupbugs.net/view.php?id=327, POSIX requires
562 time_t to be an integer type, even though C99 permits floating
563 point. We don't know of any implementation that uses floating
564 point, and it is much easier to write code that doesn't have to
565 worry about that corner case, so we force the issue. */
566 struct __time_t_must_be_integral
{
567 unsigned int __floating_time_t_unsupported
: (time_t) 1;
569 # define GNULIB_defined_struct_time_t_must_be_integral 1
572 /* Sleep for at least RQTP seconds unless interrupted, If interrupted,
573 return -1 and store the remaining time into RMTP. See
574 <http://www.opengroup.org/susv3xsh/nanosleep.html>. */
576 # if GNULIB_PORTCHECK
577 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
578 # define nanosleep rpl_nanosleep
580 _GL_FUNCDECL_RPL (nanosleep
, int,
581 (struct timespec
const *__rqtp
, struct timespec
*__rmtp
)
582 _GL_ARG_NONNULL ((1)));
583 _GL_CXXALIAS_RPL (nanosleep
, int,
584 (struct timespec
const *__rqtp
, struct timespec
*__rmtp
));
587 _GL_FUNCDECL_SYS (nanosleep
, int,
588 (struct timespec
const *__rqtp
, struct timespec
*__rmtp
)
589 _GL_ARG_NONNULL ((1)));
591 _GL_CXXALIAS_SYS (nanosleep
, int,
592 (struct timespec
const *__rqtp
, struct timespec
*__rmtp
));
594 _GL_CXXALIASWARN (nanosleep
);
597 /* Initialize time conversion information. */
600 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
602 # define tzset rpl_tzset
604 _GL_FUNCDECL_RPL (tzset
, void, (void));
605 _GL_CXXALIAS_RPL (tzset
, void, (void));
608 _GL_FUNCDECL_SYS (tzset
, void, (void));
610 _GL_CXXALIAS_SYS (tzset
, void, (void));
612 _GL_CXXALIASWARN (tzset
);
615 /* Return the 'time_t' representation of TP and normalize TP. */
618 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
619 # define mktime rpl_mktime
621 _GL_FUNCDECL_RPL (mktime
, time_t, (struct tm
*__tp
) _GL_ARG_NONNULL ((1)));
622 _GL_CXXALIAS_RPL (mktime
, time_t, (struct tm
*__tp
));
624 _GL_CXXALIAS_SYS (mktime
, time_t, (struct tm
*__tp
));
626 _GL_CXXALIASWARN (mktime
);
629 /* Convert TIMER to RESULT, assuming local time and UTC respectively. See
630 <http://www.opengroup.org/susv3xsh/localtime_r.html> and
631 <http://www.opengroup.org/susv3xsh/gmtime_r.html>. */
634 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
636 # define localtime_r rpl_localtime_r
638 _GL_FUNCDECL_RPL (localtime_r
, struct tm
*, (time_t const *restrict __timer
,
639 struct tm
*restrict __result
)
640 _GL_ARG_NONNULL ((1, 2)));
641 _GL_CXXALIAS_RPL (localtime_r
, struct tm
*, (time_t const *restrict __timer
,
642 struct tm
*restrict __result
));
645 _GL_FUNCDECL_SYS (localtime_r
, struct tm
*, (time_t const *restrict __timer
,
646 struct tm
*restrict __result
)
647 _GL_ARG_NONNULL ((1, 2)));
649 _GL_CXXALIAS_SYS (localtime_r
, struct tm
*, (time_t const *restrict __timer
,
650 struct tm
*restrict __result
));
653 _GL_CXXALIASWARN (localtime_r
);
656 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
658 # define gmtime_r rpl_gmtime_r
660 _GL_FUNCDECL_RPL (gmtime_r
, struct tm
*, (time_t const *restrict __timer
,
661 struct tm
*restrict __result
)
662 _GL_ARG_NONNULL ((1, 2)));
663 _GL_CXXALIAS_RPL (gmtime_r
, struct tm
*, (time_t const *restrict __timer
,
664 struct tm
*restrict __result
));
667 _GL_FUNCDECL_SYS (gmtime_r
, struct tm
*, (time_t const *restrict __timer
,
668 struct tm
*restrict __result
)
669 _GL_ARG_NONNULL ((1, 2)));
671 _GL_CXXALIAS_SYS (gmtime_r
, struct tm
*, (time_t const *restrict __timer
,
672 struct tm
*restrict __result
));
675 _GL_CXXALIASWARN (gmtime_r
);
679 /* Convert TIMER to RESULT, assuming local time and UTC respectively. See
680 <http://www.opengroup.org/susv3xsh/localtime.html> and
681 <http://www.opengroup.org/susv3xsh/gmtime.html>. */
684 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
686 # define localtime rpl_localtime
688 _GL_FUNCDECL_RPL (localtime
, struct tm
*, (time_t const *__timer
)
689 _GL_ARG_NONNULL ((1)));
690 _GL_CXXALIAS_RPL (localtime
, struct tm
*, (time_t const *__timer
));
692 _GL_CXXALIAS_SYS (localtime
, struct tm
*, (time_t const *__timer
));
694 _GL_CXXALIASWARN (localtime
);
699 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
701 # define gmtime rpl_gmtime
703 _GL_FUNCDECL_RPL (gmtime
, struct tm
*, (time_t const *__timer
)
704 _GL_ARG_NONNULL ((1)));
705 _GL_CXXALIAS_RPL (gmtime
, struct tm
*, (time_t const *__timer
));
707 _GL_CXXALIAS_SYS (gmtime
, struct tm
*, (time_t const *__timer
));
709 _GL_CXXALIASWARN (gmtime
);
712 /* Parse BUF as a timestamp, assuming FORMAT specifies its layout, and store
713 the resulting broken-down time into TM. See
714 <http://www.opengroup.org/susv3xsh/strptime.html>. */
717 _GL_FUNCDECL_SYS (strptime
, char *, (char const *restrict __buf
,
718 char const *restrict __format
,
719 struct tm
*restrict __tm
)
720 _GL_ARG_NONNULL ((1, 2, 3)));
722 _GL_CXXALIAS_SYS (strptime
, char *, (char const *restrict __buf
,
723 char const *restrict __format
,
724 struct tm
*restrict __tm
));
725 _GL_CXXALIASWARN (strptime
);
728 /* Convert *TP to a date and time string. See
729 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/ctime.html>. */
731 # if GNULIB_PORTCHECK
732 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
733 # define ctime rpl_ctime
735 _GL_FUNCDECL_RPL (ctime
, char *, (time_t const *__tp
)
736 _GL_ARG_NONNULL ((1)));
737 _GL_CXXALIAS_RPL (ctime
, char *, (time_t const *__tp
));
739 _GL_CXXALIAS_SYS (ctime
, char *, (time_t const *__tp
));
741 _GL_CXXALIASWARN (ctime
);
744 /* Convert *TP to a date and time string. See
745 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html>. */
747 # if GNULIB_PORTCHECK
748 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
749 # define strftime rpl_strftime
751 _GL_FUNCDECL_RPL (strftime
, size_t, (char *__buf
, size_t __bufsize
,
752 const char *__fmt
, const struct tm
*__tp
)
753 _GL_ARG_NONNULL ((1, 3, 4)));
754 _GL_CXXALIAS_RPL (strftime
, size_t, (char *__buf
, size_t __bufsize
,
755 const char *__fmt
, const struct tm
*__tp
));
757 _GL_CXXALIAS_SYS (strftime
, size_t, (char *__buf
, size_t __bufsize
,
758 const char *__fmt
, const struct tm
*__tp
));
760 _GL_CXXALIASWARN (strftime
);
763 # if defined _GNU_SOURCE && 1 && ! 0
764 typedef struct tm_zone
*timezone_t
;
765 _GL_FUNCDECL_SYS (tzalloc
, timezone_t
, (char const *__name
));
766 _GL_CXXALIAS_SYS (tzalloc
, timezone_t
, (char const *__name
));
767 _GL_FUNCDECL_SYS (tzfree
, void, (timezone_t __tz
));
768 _GL_CXXALIAS_SYS (tzfree
, void, (timezone_t __tz
));
769 _GL_FUNCDECL_SYS (localtime_rz
, struct tm
*,
770 (timezone_t __tz
, time_t const *restrict __timer
,
771 struct tm
*restrict __result
) _GL_ARG_NONNULL ((2, 3)));
772 _GL_CXXALIAS_SYS (localtime_rz
, struct tm
*,
773 (timezone_t __tz
, time_t const *restrict __timer
,
774 struct tm
*restrict __result
));
775 _GL_FUNCDECL_SYS (mktime_z
, time_t,
776 (timezone_t __tz
, struct tm
*restrict __result
)
777 _GL_ARG_NONNULL ((2)));
778 _GL_CXXALIAS_SYS (mktime_z
, time_t,
779 (timezone_t __tz
, struct tm
*restrict __result
));
782 /* Convert TM to a time_t value, assuming UTC. */
785 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
787 # define timegm rpl_timegm
789 _GL_FUNCDECL_RPL (timegm
, time_t, (struct tm
*__tm
) _GL_ARG_NONNULL ((1)));
790 _GL_CXXALIAS_RPL (timegm
, time_t, (struct tm
*__tm
));
793 _GL_FUNCDECL_SYS (timegm
, time_t, (struct tm
*__tm
) _GL_ARG_NONNULL ((1)));
795 _GL_CXXALIAS_SYS (timegm
, time_t, (struct tm
*__tm
));
797 _GL_CXXALIASWARN (timegm
);
800 /* Encourage applications to avoid unsafe functions that can overrun
801 buffers when given outlandish struct tm values. Portable
802 applications should use strftime (or even sprintf) instead. */
803 # if defined GNULIB_POSIXCHECK
805 _GL_WARN_ON_USE (asctime
, "asctime can overrun buffers in some cases - "
806 "better use strftime (or even sprintf) instead");
808 # if defined GNULIB_POSIXCHECK
810 _GL_WARN_ON_USE (asctime
, "asctime_r can overrun buffers in some cases - "
811 "better use strftime (or even sprintf) instead");
813 # if defined GNULIB_POSIXCHECK
815 _GL_WARN_ON_USE (asctime
, "ctime can overrun buffers in some cases - "
816 "better use strftime (or even sprintf) instead");
818 # if defined GNULIB_POSIXCHECK
820 _GL_WARN_ON_USE (asctime
, "ctime_r can overrun buffers in some cases - "
821 "better use strftime (or even sprintf) instead");