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