1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* A more-standard <time.h>.
5 Copyright (C) 2007-2011 Free Software Foundation, Inc.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
22 @PRAGMA_SYSTEM_HEADER@
26 /* Don't get in the way of glibc when it includes time.h merely to
27 declare a few standard symbols, rather than to declare all the
28 symbols. Also, Solaris 8 <time.h> eventually includes itself
29 recursively; if that is happening, just include the system <time.h>
30 without adding our own declarations. */
31 #if (defined __need_time_t || defined __need_clock_t \
32 || defined __need_timespec \
33 || defined _GL_TIME_H)
35 # @INCLUDE_NEXT@ @NEXT_TIME_H@
41 # @INCLUDE_NEXT@ @NEXT_TIME_H@
43 /* NetBSD 5.0 mis-defines NULL. */
46 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
48 /* The definition of _GL_ARG_NONNULL is copied here. */
50 /* The definition of _GL_WARN_ON_USE is copied here. */
52 /* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3).
53 Or they define it with the wrong member names or define it in <sys/time.h>
54 (e.g., FreeBSD circa 1997). Stock Mingw does not define it, but the
55 pthreads-win32 library defines it in <pthread.h>. */
56 # if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@
57 # if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
58 # include <sys/time.h>
59 # elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@
61 /* The pthreads-win32 <pthread.h> also defines a couple of broken macros. */
74 # if !GNULIB_defined_struct_timespec
76 # define timespec rpl_timespec
82 # define GNULIB_defined_struct_timespec 1
92 # if !GNULIB_defined_struct_time_t_must_be_integral
93 /* Per http://austingroupbugs.net/view.php?id=327, POSIX requires
94 time_t to be an integer type, even though C99 permits floating
95 point. We don't know of any implementation that uses floating
96 point, and it is much easier to write code that doesn't have to
97 worry about that corner case, so we force the issue. */
98 struct __time_t_must_be_integral {
99 unsigned int __floating_time_t_unsupported : (time_t) 1;
101 # define GNULIB_defined_struct_time_t_must_be_integral 1
104 /* Sleep for at least RQTP seconds unless interrupted, If interrupted,
105 return -1 and store the remaining time into RMTP. See
106 <http://www.opengroup.org/susv3xsh/nanosleep.html>. */
107 # if @GNULIB_NANOSLEEP@
108 # if @REPLACE_NANOSLEEP@
109 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
110 # define nanosleep rpl_nanosleep
112 _GL_FUNCDECL_RPL (nanosleep, int,
113 (struct timespec const *__rqtp, struct timespec *__rmtp)
114 _GL_ARG_NONNULL ((1)));
115 _GL_CXXALIAS_RPL (nanosleep, int,
116 (struct timespec const *__rqtp, struct timespec *__rmtp));
118 # if ! @HAVE_NANOSLEEP@
119 _GL_FUNCDECL_SYS (nanosleep, int,
120 (struct timespec const *__rqtp, struct timespec *__rmtp)
121 _GL_ARG_NONNULL ((1)));
123 _GL_CXXALIAS_SYS (nanosleep, int,
124 (struct timespec const *__rqtp, struct timespec *__rmtp));
126 _GL_CXXALIASWARN (nanosleep);
129 /* Return the 'time_t' representation of TP and normalize TP. */
131 # if @REPLACE_MKTIME@
132 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
133 # define mktime rpl_mktime
135 _GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1)));
136 _GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp));
138 _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp));
140 _GL_CXXALIASWARN (mktime);
143 /* Convert TIMER to RESULT, assuming local time and UTC respectively. See
144 <http://www.opengroup.org/susv3xsh/localtime_r.html> and
145 <http://www.opengroup.org/susv3xsh/gmtime_r.html>. */
147 # if @REPLACE_LOCALTIME_R@
148 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
150 # define localtime_r rpl_localtime_r
152 _GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
153 struct tm *restrict __result)
154 _GL_ARG_NONNULL ((1, 2)));
155 _GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
156 struct tm *restrict __result));
158 # if ! @HAVE_DECL_LOCALTIME_R@
159 _GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
160 struct tm *restrict __result)
161 _GL_ARG_NONNULL ((1, 2)));
163 _GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
164 struct tm *restrict __result));
166 # if @HAVE_DECL_LOCALTIME_R@
167 _GL_CXXALIASWARN (localtime_r);
169 # if @REPLACE_LOCALTIME_R@
170 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
172 # define gmtime_r rpl_gmtime_r
174 _GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
175 struct tm *restrict __result)
176 _GL_ARG_NONNULL ((1, 2)));
177 _GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
178 struct tm *restrict __result));
180 # if ! @HAVE_DECL_LOCALTIME_R@
181 _GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
182 struct tm *restrict __result)
183 _GL_ARG_NONNULL ((1, 2)));
185 _GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
186 struct tm *restrict __result));
188 # if @HAVE_DECL_LOCALTIME_R@
189 _GL_CXXALIASWARN (gmtime_r);
193 /* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
194 the resulting broken-down time into TM. See
195 <http://www.opengroup.org/susv3xsh/strptime.html>. */
196 # if @GNULIB_STRPTIME@
197 # if ! @HAVE_STRPTIME@
198 _GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf,
199 char const *restrict __format,
200 struct tm *restrict __tm)
201 _GL_ARG_NONNULL ((1, 2, 3)));
203 _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf,
204 char const *restrict __format,
205 struct tm *restrict __tm));
206 _GL_CXXALIASWARN (strptime);
209 /* Convert TM to a time_t value, assuming UTC. */
211 # if @REPLACE_TIMEGM@
212 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
214 # define timegm rpl_timegm
216 _GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
217 _GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm));
220 _GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
222 _GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm));
224 _GL_CXXALIASWARN (timegm);
227 /* Encourage applications to avoid unsafe functions that can overrun
228 buffers when given outlandish struct tm values. Portable
229 applications should use strftime (or even sprintf) instead. */
230 # if defined GNULIB_POSIXCHECK
232 _GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - "
233 "better use strftime (or even sprintf) instead");
235 # if defined GNULIB_POSIXCHECK
237 _GL_WARN_ON_USE (asctime, "asctime_r can overrun buffers in some cases - "
238 "better use strftime (or even sprintf) instead");
240 # if defined GNULIB_POSIXCHECK
242 _GL_WARN_ON_USE (asctime, "ctime can overrun buffers in some cases - "
243 "better use strftime (or even sprintf) instead");
245 # if defined GNULIB_POSIXCHECK
247 _GL_WARN_ON_USE (asctime, "ctime_r can overrun buffers in some cases - "
248 "better use strftime (or even sprintf) instead");