112308
|
1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
|
|
2 /* A more-standard <time.h>.
|
|
3
|
|
4 Copyright (C) 2007-2011 Free Software Foundation, Inc.
|
|
5
|
|
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)
|
|
9 any later version.
|
|
10
|
|
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.
|
|
15
|
|
16 You should have received a copy of the GNU General Public License
|
|
17 along with this program; if not, write to the Free Software Foundation,
|
|
18 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
|
19
|
|
20 #if __GNUC__ >= 3
|
|
21 #pragma GCC system_header
|
|
22 #endif
|
|
23
|
|
24
|
|
25 /* Don't get in the way of glibc when it includes time.h merely to
|
|
26 declare a few standard symbols, rather than to declare all the
|
|
27 symbols. 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 _GL_TIME_H)
|
|
33
|
|
34 # include_next <time.h>
|
|
35
|
|
36 #else
|
|
37
|
|
38 # define _GL_TIME_H
|
|
39
|
|
40 # include_next <time.h>
|
|
41
|
|
42 /* NetBSD 5.0 mis-defines NULL. */
|
|
43 # include <stddef.h>
|
|
44
|
|
45 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
|
|
46 #ifndef _GL_CXXDEFS_H
|
|
47 #define _GL_CXXDEFS_H
|
|
48
|
|
49 /* The three most frequent use cases of these macros are:
|
|
50
|
|
51 * For providing a substitute for a function that is missing on some
|
|
52 platforms, but is declared and works fine on the platforms on which
|
|
53 it exists:
|
|
54
|
|
55 #if @GNULIB_FOO@
|
|
56 # if !@HAVE_FOO@
|
|
57 _GL_FUNCDECL_SYS (foo, ...);
|
|
58 # endif
|
|
59 _GL_CXXALIAS_SYS (foo, ...);
|
|
60 _GL_CXXALIASWARN (foo);
|
|
61 #elif defined GNULIB_POSIXCHECK
|
|
62 ...
|
|
63 #endif
|
|
64
|
|
65 * For providing a replacement for a function that exists on all platforms,
|
|
66 but is broken/insufficient and needs to be replaced on some platforms:
|
|
67
|
|
68 #if @GNULIB_FOO@
|
|
69 # if @REPLACE_FOO@
|
|
70 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
71 # undef foo
|
|
72 # define foo rpl_foo
|
|
73 # endif
|
|
74 _GL_FUNCDECL_RPL (foo, ...);
|
|
75 _GL_CXXALIAS_RPL (foo, ...);
|
|
76 # else
|
|
77 _GL_CXXALIAS_SYS (foo, ...);
|
|
78 # endif
|
|
79 _GL_CXXALIASWARN (foo);
|
|
80 #elif defined GNULIB_POSIXCHECK
|
|
81 ...
|
|
82 #endif
|
|
83
|
|
84 * For providing a replacement for a function that exists on some platforms
|
|
85 but is broken/insufficient and needs to be replaced on some of them and
|
|
86 is additionally either missing or undeclared on some other platforms:
|
|
87
|
|
88 #if @GNULIB_FOO@
|
|
89 # if @REPLACE_FOO@
|
|
90 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
91 # undef foo
|
|
92 # define foo rpl_foo
|
|
93 # endif
|
|
94 _GL_FUNCDECL_RPL (foo, ...);
|
|
95 _GL_CXXALIAS_RPL (foo, ...);
|
|
96 # else
|
|
97 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
|
|
98 _GL_FUNCDECL_SYS (foo, ...);
|
|
99 # endif
|
|
100 _GL_CXXALIAS_SYS (foo, ...);
|
|
101 # endif
|
|
102 _GL_CXXALIASWARN (foo);
|
|
103 #elif defined GNULIB_POSIXCHECK
|
|
104 ...
|
|
105 #endif
|
|
106 */
|
|
107
|
|
108 /* _GL_EXTERN_C declaration;
|
|
109 performs the declaration with C linkage. */
|
|
110 #if defined __cplusplus
|
|
111 # define _GL_EXTERN_C extern "C"
|
|
112 #else
|
|
113 # define _GL_EXTERN_C extern
|
|
114 #endif
|
|
115
|
|
116 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
|
|
117 declares a replacement function, named rpl_func, with the given prototype,
|
|
118 consisting of return type, parameters, and attributes.
|
|
119 Example:
|
|
120 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
|
|
121 _GL_ARG_NONNULL ((1)));
|
|
122 */
|
|
123 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
|
|
124 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
|
|
125 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
|
|
126 _GL_EXTERN_C rettype rpl_func parameters_and_attributes
|
|
127
|
|
128 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
|
|
129 declares the system function, named func, with the given prototype,
|
|
130 consisting of return type, parameters, and attributes.
|
|
131 Example:
|
|
132 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
|
|
133 _GL_ARG_NONNULL ((1)));
|
|
134 */
|
|
135 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
|
|
136 _GL_EXTERN_C rettype func parameters_and_attributes
|
|
137
|
|
138 /* _GL_CXXALIAS_RPL (func, rettype, parameters);
|
|
139 declares a C++ alias called GNULIB_NAMESPACE::func
|
|
140 that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
|
|
141 Example:
|
|
142 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
|
|
143 */
|
|
144 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
|
|
145 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
|
|
146 #if defined __cplusplus && defined GNULIB_NAMESPACE
|
|
147 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
|
|
148 namespace GNULIB_NAMESPACE \
|
|
149 { \
|
|
150 rettype (*const func) parameters = ::rpl_func; \
|
|
151 } \
|
|
152 _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
153 #else
|
|
154 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
|
|
155 _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
156 #endif
|
|
157
|
|
158 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
|
|
159 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
|
|
160 except that the C function rpl_func may have a slightly different
|
|
161 declaration. A cast is used to silence the "invalid conversion" error
|
|
162 that would otherwise occur. */
|
|
163 #if defined __cplusplus && defined GNULIB_NAMESPACE
|
|
164 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
|
|
165 namespace GNULIB_NAMESPACE \
|
|
166 { \
|
|
167 rettype (*const func) parameters = \
|
|
168 reinterpret_cast<rettype(*)parameters>(::rpl_func); \
|
|
169 } \
|
|
170 _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
171 #else
|
|
172 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
|
|
173 _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
174 #endif
|
|
175
|
|
176 /* _GL_CXXALIAS_SYS (func, rettype, parameters);
|
|
177 declares a C++ alias called GNULIB_NAMESPACE::func
|
|
178 that redirects to the system provided function func, if GNULIB_NAMESPACE
|
|
179 is defined.
|
|
180 Example:
|
|
181 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
|
|
182 */
|
|
183 #if defined __cplusplus && defined GNULIB_NAMESPACE
|
|
184 /* If we were to write
|
|
185 rettype (*const func) parameters = ::func;
|
|
186 like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
|
|
187 better (remove an indirection through a 'static' pointer variable),
|
|
188 but then the _GL_CXXALIASWARN macro below would cause a warning not only
|
|
189 for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */
|
|
190 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
|
|
191 namespace GNULIB_NAMESPACE \
|
|
192 { \
|
|
193 static rettype (*func) parameters = ::func; \
|
|
194 } \
|
|
195 _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
196 #else
|
|
197 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
|
|
198 _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
199 #endif
|
|
200
|
|
201 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
|
|
202 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
|
|
203 except that the C function func may have a slightly different declaration.
|
|
204 A cast is used to silence the "invalid conversion" error that would
|
|
205 otherwise occur. */
|
|
206 #if defined __cplusplus && defined GNULIB_NAMESPACE
|
|
207 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
|
|
208 namespace GNULIB_NAMESPACE \
|
|
209 { \
|
|
210 static rettype (*func) parameters = \
|
|
211 reinterpret_cast<rettype(*)parameters>(::func); \
|
|
212 } \
|
|
213 _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
214 #else
|
|
215 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
|
|
216 _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
217 #endif
|
|
218
|
|
219 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
|
|
220 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
|
|
221 except that the C function is picked among a set of overloaded functions,
|
|
222 namely the one with rettype2 and parameters2. Two consecutive casts
|
|
223 are used to silence the "cannot find a match" and "invalid conversion"
|
|
224 errors that would otherwise occur. */
|
|
225 #if defined __cplusplus && defined GNULIB_NAMESPACE
|
|
226 /* The outer cast must be a reinterpret_cast.
|
|
227 The inner cast: When the function is defined as a set of overloaded
|
|
228 functions, it works as a static_cast<>, choosing the designated variant.
|
|
229 When the function is defined as a single variant, it works as a
|
|
230 reinterpret_cast<>. The parenthesized cast syntax works both ways. */
|
|
231 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
|
|
232 namespace GNULIB_NAMESPACE \
|
|
233 { \
|
|
234 static rettype (*func) parameters = \
|
|
235 reinterpret_cast<rettype(*)parameters>( \
|
|
236 (rettype2(*)parameters2)(::func)); \
|
|
237 } \
|
|
238 _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
239 #else
|
|
240 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
|
|
241 _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
242 #endif
|
|
243
|
|
244 /* _GL_CXXALIASWARN (func);
|
|
245 causes a warning to be emitted when ::func is used but not when
|
|
246 GNULIB_NAMESPACE::func is used. func must be defined without overloaded
|
|
247 variants. */
|
|
248 #if defined __cplusplus && defined GNULIB_NAMESPACE
|
|
249 # define _GL_CXXALIASWARN(func) \
|
|
250 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
|
|
251 # define _GL_CXXALIASWARN_1(func,namespace) \
|
|
252 _GL_CXXALIASWARN_2 (func, namespace)
|
|
253 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
|
|
254 we enable the warning only when not optimizing. */
|
|
255 # if !__OPTIMIZE__
|
|
256 # define _GL_CXXALIASWARN_2(func,namespace) \
|
|
257 _GL_WARN_ON_USE (func, \
|
|
258 "The symbol ::" #func " refers to the system function. " \
|
|
259 "Use " #namespace "::" #func " instead.")
|
|
260 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
|
|
261 # define _GL_CXXALIASWARN_2(func,namespace) \
|
|
262 extern __typeof__ (func) func
|
|
263 # else
|
|
264 # define _GL_CXXALIASWARN_2(func,namespace) \
|
|
265 _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
266 # endif
|
|
267 #else
|
|
268 # define _GL_CXXALIASWARN(func) \
|
|
269 _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
270 #endif
|
|
271
|
|
272 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
|
|
273 causes a warning to be emitted when the given overloaded variant of ::func
|
|
274 is used but not when GNULIB_NAMESPACE::func is used. */
|
|
275 #if defined __cplusplus && defined GNULIB_NAMESPACE
|
|
276 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
|
|
277 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
|
|
278 GNULIB_NAMESPACE)
|
|
279 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
|
|
280 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
|
|
281 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
|
|
282 we enable the warning only when not optimizing. */
|
|
283 # if !__OPTIMIZE__
|
|
284 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
|
|
285 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
|
|
286 "The symbol ::" #func " refers to the system function. " \
|
|
287 "Use " #namespace "::" #func " instead.")
|
|
288 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
|
|
289 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
|
|
290 extern __typeof__ (func) func
|
|
291 # else
|
|
292 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
|
|
293 _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
294 # endif
|
|
295 #else
|
|
296 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
|
|
297 _GL_EXTERN_C int _gl_cxxalias_dummy
|
|
298 #endif
|
|
299
|
|
300 #endif /* _GL_CXXDEFS_H */
|
|
301
|
|
302 /* The definition of _GL_ARG_NONNULL is copied here. */
|
|
303 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
|
|
304 that the values passed as arguments n, ..., m must be non-NULL pointers.
|
|
305 n = 1 stands for the first argument, n = 2 for the second argument etc. */
|
|
306 #ifndef _GL_ARG_NONNULL
|
|
307 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
|
|
308 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
|
|
309 # else
|
|
310 # define _GL_ARG_NONNULL(params)
|
|
311 # endif
|
|
312 #endif
|
|
313
|
|
314 /* The definition of _GL_WARN_ON_USE is copied here. */
|
|
315 #ifndef _GL_WARN_ON_USE
|
|
316
|
|
317 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
|
|
318 /* A compiler attribute is available in gcc versions 4.3.0 and later. */
|
|
319 # define _GL_WARN_ON_USE(function, message) \
|
|
320 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
|
|
321 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
|
|
322 /* Verify the existence of the function. */
|
|
323 # define _GL_WARN_ON_USE(function, message) \
|
|
324 extern __typeof__ (function) function
|
|
325 # else /* Unsupported. */
|
|
326 # define _GL_WARN_ON_USE(function, message) \
|
|
327 _GL_WARN_EXTERN_C int _gl_warn_on_use
|
|
328 # endif
|
|
329 #endif
|
|
330
|
|
331 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
|
|
332 is like _GL_WARN_ON_USE (function, "string"), except that the function is
|
|
333 declared with the given prototype, consisting of return type, parameters,
|
|
334 and attributes.
|
|
335 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
|
|
336 not work in this case. */
|
|
337 #ifndef _GL_WARN_ON_USE_CXX
|
|
338 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
|
|
339 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
|
|
340 extern rettype function parameters_and_attributes \
|
|
341 __attribute__ ((__warning__ (msg)))
|
|
342 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
|
|
343 /* Verify the existence of the function. */
|
|
344 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
|
|
345 extern rettype function parameters_and_attributes
|
|
346 # else /* Unsupported. */
|
|
347 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
|
|
348 _GL_WARN_EXTERN_C int _gl_warn_on_use
|
|
349 # endif
|
|
350 #endif
|
|
351
|
|
352 /* _GL_WARN_EXTERN_C declaration;
|
|
353 performs the declaration with C linkage. */
|
|
354 #ifndef _GL_WARN_EXTERN_C
|
|
355 # if defined __cplusplus
|
|
356 # define _GL_WARN_EXTERN_C extern "C"
|
|
357 # else
|
|
358 # define _GL_WARN_EXTERN_C extern
|
|
359 # endif
|
|
360 #endif
|
|
361
|
|
362 /* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3).
|
|
363 Or they define it with the wrong member names or define it in <sys/time.h>
|
|
364 (e.g., FreeBSD circa 1997). Stock Mingw does not define it, but the
|
|
365 pthreads-win32 library defines it in <pthread.h>. */
|
|
366 # if ! 1
|
|
367 # if 0
|
|
368 # include <sys/time.h>
|
|
369 # elif 0
|
|
370 # include <pthread.h>
|
|
371 /* The pthreads-win32 <pthread.h> also defines a couple of broken macros. */
|
|
372 # undef asctime_r
|
|
373 # undef ctime_r
|
|
374 # undef gmtime_r
|
|
375 # undef localtime_r
|
|
376 # undef rand_r
|
|
377 # undef strtok_r
|
|
378 # else
|
|
379
|
|
380 # ifdef __cplusplus
|
|
381 extern "C" {
|
|
382 # endif
|
|
383
|
|
384 # undef timespec
|
|
385 # define timespec rpl_timespec
|
|
386 struct timespec
|
|
387 {
|
|
388 time_t tv_sec;
|
|
389 long int tv_nsec;
|
|
390 };
|
|
391
|
|
392 # ifdef __cplusplus
|
|
393 }
|
|
394 # endif
|
|
395
|
|
396 # endif
|
|
397 # endif
|
|
398
|
|
399 /* Per http://austingroupbugs.net/view.php?id=327, POSIX requires
|
|
400 time_t to be an integer type, even though C99 permits floating
|
|
401 point. We don't know of any implementation that uses floating
|
|
402 point, and it is much easier to write code that doesn't have to
|
|
403 worry about that corner case, so we force the issue. */
|
|
404 struct __time_t_must_be_integral {
|
|
405 unsigned int __floating_time_t_unsupported : (time_t) 1;
|
|
406 };
|
|
407
|
|
408 /* Sleep for at least RQTP seconds unless interrupted, If interrupted,
|
|
409 return -1 and store the remaining time into RMTP. See
|
|
410 <http://www.opengroup.org/susv3xsh/nanosleep.html>. */
|
|
411 # if 0
|
|
412 # if GNULIB_PORTCHECK
|
|
413 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
414 # define nanosleep rpl_nanosleep
|
|
415 # endif
|
|
416 _GL_FUNCDECL_RPL (nanosleep, int,
|
|
417 (struct timespec const *__rqtp, struct timespec *__rmtp)
|
|
418 _GL_ARG_NONNULL ((1)));
|
|
419 _GL_CXXALIAS_RPL (nanosleep, int,
|
|
420 (struct timespec const *__rqtp, struct timespec *__rmtp));
|
|
421 # else
|
|
422 # if ! 1
|
|
423 _GL_FUNCDECL_SYS (nanosleep, int,
|
|
424 (struct timespec const *__rqtp, struct timespec *__rmtp)
|
|
425 _GL_ARG_NONNULL ((1)));
|
|
426 # endif
|
|
427 _GL_CXXALIAS_SYS (nanosleep, int,
|
|
428 (struct timespec const *__rqtp, struct timespec *__rmtp));
|
|
429 # endif
|
|
430 _GL_CXXALIASWARN (nanosleep);
|
|
431 # endif
|
|
432
|
|
433 /* Return the 'time_t' representation of TP and normalize TP. */
|
|
434 # if 1
|
|
435 # if 0
|
|
436 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
437 # define mktime rpl_mktime
|
|
438 # endif
|
|
439 _GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1)));
|
|
440 _GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp));
|
|
441 # else
|
|
442 _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp));
|
|
443 # endif
|
|
444 _GL_CXXALIASWARN (mktime);
|
|
445 # endif
|
|
446
|
|
447 /* Convert TIMER to RESULT, assuming local time and UTC respectively. See
|
|
448 <http://www.opengroup.org/susv3xsh/localtime_r.html> and
|
|
449 <http://www.opengroup.org/susv3xsh/gmtime_r.html>. */
|
|
450 # if 1
|
|
451 # if 0
|
|
452 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
453 # undef localtime_r
|
|
454 # define localtime_r rpl_localtime_r
|
|
455 # endif
|
|
456 _GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
|
|
457 struct tm *restrict __result)
|
|
458 _GL_ARG_NONNULL ((1, 2)));
|
|
459 _GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
|
|
460 struct tm *restrict __result));
|
|
461 # else
|
|
462 # if ! 0
|
|
463 _GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
|
|
464 struct tm *restrict __result)
|
|
465 _GL_ARG_NONNULL ((1, 2)));
|
|
466 # endif
|
|
467 _GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
|
|
468 struct tm *restrict __result));
|
|
469 # endif
|
|
470 # if 0
|
|
471 _GL_CXXALIASWARN (localtime_r);
|
|
472 # endif
|
|
473 # if 0
|
|
474 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
475 # undef gmtime_r
|
|
476 # define gmtime_r rpl_gmtime_r
|
|
477 # endif
|
|
478 _GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
|
|
479 struct tm *restrict __result)
|
|
480 _GL_ARG_NONNULL ((1, 2)));
|
|
481 _GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
|
|
482 struct tm *restrict __result));
|
|
483 # else
|
|
484 # if ! 0
|
|
485 _GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
|
|
486 struct tm *restrict __result)
|
|
487 _GL_ARG_NONNULL ((1, 2)));
|
|
488 # endif
|
|
489 _GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
|
|
490 struct tm *restrict __result));
|
|
491 # endif
|
|
492 # if 0
|
|
493 _GL_CXXALIASWARN (gmtime_r);
|
|
494 # endif
|
|
495 # endif
|
|
496
|
|
497 /* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
|
|
498 the resulting broken-down time into TM. See
|
|
499 <http://www.opengroup.org/susv3xsh/strptime.html>. */
|
|
500 # if 0
|
|
501 # if ! 1
|
|
502 _GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf,
|
|
503 char const *restrict __format,
|
|
504 struct tm *restrict __tm)
|
|
505 _GL_ARG_NONNULL ((1, 2, 3)));
|
|
506 # endif
|
|
507 _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf,
|
|
508 char const *restrict __format,
|
|
509 struct tm *restrict __tm));
|
|
510 _GL_CXXALIASWARN (strptime);
|
|
511 # endif
|
|
512
|
|
513 /* Convert TM to a time_t value, assuming UTC. */
|
|
514 # if 0
|
|
515 # if GNULIB_PORTCHECK
|
|
516 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
517 # undef timegm
|
|
518 # define timegm rpl_timegm
|
|
519 # endif
|
|
520 _GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
|
|
521 _GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm));
|
|
522 # else
|
|
523 # if ! 1
|
|
524 _GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
|
|
525 # endif
|
|
526 _GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm));
|
|
527 # endif
|
|
528 _GL_CXXALIASWARN (timegm);
|
|
529 # endif
|
|
530
|
|
531 /* Encourage applications to avoid unsafe functions that can overrun
|
|
532 buffers when given outlandish struct tm values. Portable
|
|
533 applications should use strftime (or even sprintf) instead. */
|
|
534 # if defined GNULIB_POSIXCHECK
|
|
535 # undef asctime
|
|
536 _GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - "
|
|
537 "better use strftime (or even sprintf) instead");
|
|
538 # endif
|
|
539 # if defined GNULIB_POSIXCHECK
|
|
540 # undef asctime_r
|
|
541 _GL_WARN_ON_USE (asctime, "asctime_r can overrun buffers in some cases - "
|
|
542 "better use strftime (or even sprintf) instead");
|
|
543 # endif
|
|
544 # if defined GNULIB_POSIXCHECK
|
|
545 # undef ctime
|
|
546 _GL_WARN_ON_USE (asctime, "ctime can overrun buffers in some cases - "
|
|
547 "better use strftime (or even sprintf) instead");
|
|
548 # endif
|
|
549 # if defined GNULIB_POSIXCHECK
|
|
550 # undef ctime_r
|
|
551 _GL_WARN_ON_USE (asctime, "ctime_r can overrun buffers in some cases - "
|
|
552 "better use strftime (or even sprintf) instead");
|
|
553 # endif
|
|
554
|
|
555 #endif
|