diff options
Diffstat (limited to 'gl/time.in.h')
| -rw-r--r-- | gl/time.in.h | 141 |
1 files changed, 98 insertions, 43 deletions
diff --git a/gl/time.in.h b/gl/time.in.h index df99c8ab..5bbccf76 100644 --- a/gl/time.in.h +++ b/gl/time.in.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* A more-standard <time.h>. | 1 | /* A more-standard <time.h>. |
| 2 | 2 | ||
| 3 | Copyright (C) 2007-2024 Free Software Foundation, Inc. | 3 | Copyright (C) 2007-2026 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
| @@ -122,6 +122,23 @@ struct __time_t_must_be_integral { | |||
| 122 | # endif | 122 | # endif |
| 123 | # endif | 123 | # endif |
| 124 | 124 | ||
| 125 | # if @GNULIB_TZNAME@ | ||
| 126 | /* tzname[0..1]: Abbreviated time zone names, set by the tzset() function. */ | ||
| 127 | # if NEED_DECL_TZNAME | ||
| 128 | extern | ||
| 129 | # ifdef __cplusplus | ||
| 130 | "C" | ||
| 131 | # endif | ||
| 132 | char *tzname[]; | ||
| 133 | # endif | ||
| 134 | # if defined _WIN32 && !defined __CYGWIN__ | ||
| 135 | /* On native Windows, map 'tzname' to '_tzname' etc., so that -loldnames is not | ||
| 136 | required. */ | ||
| 137 | # undef tzname | ||
| 138 | # define tzname _tzname | ||
| 139 | # endif | ||
| 140 | # endif | ||
| 141 | |||
| 125 | /* Set *TS to the current time, and return BASE. | 142 | /* Set *TS to the current time, and return BASE. |
| 126 | Upon failure, return 0. */ | 143 | Upon failure, return 0. */ |
| 127 | # if @GNULIB_TIMESPEC_GET@ | 144 | # if @GNULIB_TIMESPEC_GET@ |
| @@ -130,12 +147,12 @@ struct __time_t_must_be_integral { | |||
| 130 | # undef timespec_get | 147 | # undef timespec_get |
| 131 | # define timespec_get rpl_timespec_get | 148 | # define timespec_get rpl_timespec_get |
| 132 | # endif | 149 | # endif |
| 133 | _GL_FUNCDECL_RPL (timespec_get, int, (struct timespec *ts, int base) | 150 | _GL_FUNCDECL_RPL (timespec_get, int, (struct timespec *ts, int base), |
| 134 | _GL_ARG_NONNULL ((1))); | 151 | _GL_ARG_NONNULL ((1))); |
| 135 | _GL_CXXALIAS_RPL (timespec_get, int, (struct timespec *ts, int base)); | 152 | _GL_CXXALIAS_RPL (timespec_get, int, (struct timespec *ts, int base)); |
| 136 | # else | 153 | # else |
| 137 | # if !@HAVE_TIMESPEC_GET@ | 154 | # if !@HAVE_TIMESPEC_GET@ |
| 138 | _GL_FUNCDECL_SYS (timespec_get, int, (struct timespec *ts, int base) | 155 | _GL_FUNCDECL_SYS (timespec_get, int, (struct timespec *ts, int base), |
| 139 | _GL_ARG_NONNULL ((1))); | 156 | _GL_ARG_NONNULL ((1))); |
| 140 | # endif | 157 | # endif |
| 141 | _GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, int base)); | 158 | _GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, int base)); |
| @@ -144,7 +161,6 @@ _GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, int base)); | |||
| 144 | _GL_CXXALIASWARN (timespec_get); | 161 | _GL_CXXALIASWARN (timespec_get); |
| 145 | # endif | 162 | # endif |
| 146 | # elif defined GNULIB_POSIXCHECK | 163 | # elif defined GNULIB_POSIXCHECK |
| 147 | # undef timespec_get | ||
| 148 | # if HAVE_RAW_DECL_TIMESPEC_GET | 164 | # if HAVE_RAW_DECL_TIMESPEC_GET |
| 149 | _GL_WARN_ON_USE (timespec_get, "timespec_get is unportable - " | 165 | _GL_WARN_ON_USE (timespec_get, "timespec_get is unportable - " |
| 150 | "use gnulib module timespec_get for portability"); | 166 | "use gnulib module timespec_get for portability"); |
| @@ -159,19 +175,20 @@ _GL_WARN_ON_USE (timespec_get, "timespec_get is unportable - " | |||
| 159 | # undef timespec_getres | 175 | # undef timespec_getres |
| 160 | # define timespec_getres rpl_timespec_getres | 176 | # define timespec_getres rpl_timespec_getres |
| 161 | # endif | 177 | # endif |
| 162 | _GL_FUNCDECL_RPL (timespec_getres, int, (struct timespec *ts, int base) | 178 | _GL_FUNCDECL_RPL (timespec_getres, int, (struct timespec *ts, int base), |
| 163 | _GL_ARG_NONNULL ((1))); | 179 | _GL_ARG_NONNULL ((1))); |
| 164 | _GL_CXXALIAS_RPL (timespec_getres, int, (struct timespec *ts, int base)); | 180 | _GL_CXXALIAS_RPL (timespec_getres, int, (struct timespec *ts, int base)); |
| 165 | # else | 181 | # else |
| 166 | # if !@HAVE_TIMESPEC_GETRES@ | 182 | # if !@HAVE_TIMESPEC_GETRES@ |
| 167 | _GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base) | 183 | _GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base), |
| 168 | _GL_ARG_NONNULL ((1))); | 184 | _GL_ARG_NONNULL ((1))); |
| 169 | # endif | 185 | # endif |
| 170 | _GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base)); | 186 | _GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base)); |
| 171 | # endif | 187 | # endif |
| 188 | # if __GLIBC__ >= 2 | ||
| 172 | _GL_CXXALIASWARN (timespec_getres); | 189 | _GL_CXXALIASWARN (timespec_getres); |
| 190 | # endif | ||
| 173 | # elif defined GNULIB_POSIXCHECK | 191 | # elif defined GNULIB_POSIXCHECK |
| 174 | # undef timespec_getres | ||
| 175 | # if HAVE_RAW_DECL_TIMESPEC_GETRES | 192 | # if HAVE_RAW_DECL_TIMESPEC_GETRES |
| 176 | _GL_WARN_ON_USE (timespec_getres, "timespec_getres is unportable - " | 193 | _GL_WARN_ON_USE (timespec_getres, "timespec_getres is unportable - " |
| 177 | "use gnulib module timespec_getres for portability"); | 194 | "use gnulib module timespec_getres for portability"); |
| @@ -184,7 +201,7 @@ _GL_WARN_ON_USE (timespec_getres, "timespec_getres is unportable - " | |||
| 184 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 201 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 185 | # define time rpl_time | 202 | # define time rpl_time |
| 186 | # endif | 203 | # endif |
| 187 | _GL_FUNCDECL_RPL (time, time_t, (time_t *__tp)); | 204 | _GL_FUNCDECL_RPL (time, time_t, (time_t *__tp), ); |
| 188 | _GL_CXXALIAS_RPL (time, time_t, (time_t *__tp)); | 205 | _GL_CXXALIAS_RPL (time, time_t, (time_t *__tp)); |
| 189 | # else | 206 | # else |
| 190 | _GL_CXXALIAS_SYS (time, time_t, (time_t *__tp)); | 207 | _GL_CXXALIAS_SYS (time, time_t, (time_t *__tp)); |
| @@ -193,7 +210,6 @@ _GL_CXXALIAS_SYS (time, time_t, (time_t *__tp)); | |||
| 193 | _GL_CXXALIASWARN (time); | 210 | _GL_CXXALIASWARN (time); |
| 194 | # endif | 211 | # endif |
| 195 | # elif defined GNULIB_POSIXCHECK | 212 | # elif defined GNULIB_POSIXCHECK |
| 196 | # undef time | ||
| 197 | # if HAVE_RAW_DECL_TIME | 213 | # if HAVE_RAW_DECL_TIME |
| 198 | _GL_WARN_ON_USE (time, "time has consistency problems - " | 214 | _GL_WARN_ON_USE (time, "time has consistency problems - " |
| 199 | "use gnulib module time for portability"); | 215 | "use gnulib module time for portability"); |
| @@ -209,14 +225,14 @@ _GL_WARN_ON_USE (time, "time has consistency problems - " | |||
| 209 | # define nanosleep rpl_nanosleep | 225 | # define nanosleep rpl_nanosleep |
| 210 | # endif | 226 | # endif |
| 211 | _GL_FUNCDECL_RPL (nanosleep, int, | 227 | _GL_FUNCDECL_RPL (nanosleep, int, |
| 212 | (struct timespec const *__rqtp, struct timespec *__rmtp) | 228 | (struct timespec const *__rqtp, struct timespec *__rmtp), |
| 213 | _GL_ARG_NONNULL ((1))); | 229 | _GL_ARG_NONNULL ((1))); |
| 214 | _GL_CXXALIAS_RPL (nanosleep, int, | 230 | _GL_CXXALIAS_RPL (nanosleep, int, |
| 215 | (struct timespec const *__rqtp, struct timespec *__rmtp)); | 231 | (struct timespec const *__rqtp, struct timespec *__rmtp)); |
| 216 | # else | 232 | # else |
| 217 | # if ! @HAVE_NANOSLEEP@ | 233 | # if ! @HAVE_NANOSLEEP@ |
| 218 | _GL_FUNCDECL_SYS (nanosleep, int, | 234 | _GL_FUNCDECL_SYS (nanosleep, int, |
| 219 | (struct timespec const *__rqtp, struct timespec *__rmtp) | 235 | (struct timespec const *__rqtp, struct timespec *__rmtp), |
| 220 | _GL_ARG_NONNULL ((1))); | 236 | _GL_ARG_NONNULL ((1))); |
| 221 | # endif | 237 | # endif |
| 222 | _GL_CXXALIAS_SYS (nanosleep, int, | 238 | _GL_CXXALIAS_SYS (nanosleep, int, |
| @@ -224,7 +240,6 @@ _GL_CXXALIAS_SYS (nanosleep, int, | |||
| 224 | # endif | 240 | # endif |
| 225 | _GL_CXXALIASWARN (nanosleep); | 241 | _GL_CXXALIASWARN (nanosleep); |
| 226 | # elif defined GNULIB_POSIXCHECK | 242 | # elif defined GNULIB_POSIXCHECK |
| 227 | # undef nanosleep | ||
| 228 | # if HAVE_RAW_DECL_NANOSLEEP | 243 | # if HAVE_RAW_DECL_NANOSLEEP |
| 229 | _GL_WARN_ON_USE (nanosleep, "nanosleep is unportable - " | 244 | _GL_WARN_ON_USE (nanosleep, "nanosleep is unportable - " |
| 230 | "use gnulib module nanosleep for portability"); | 245 | "use gnulib module nanosleep for portability"); |
| @@ -238,7 +253,7 @@ _GL_WARN_ON_USE (nanosleep, "nanosleep is unportable - " | |||
| 238 | # undef tzset | 253 | # undef tzset |
| 239 | # define tzset rpl_tzset | 254 | # define tzset rpl_tzset |
| 240 | # endif | 255 | # endif |
| 241 | _GL_FUNCDECL_RPL (tzset, void, (void)); | 256 | _GL_FUNCDECL_RPL (tzset, void, (void), ); |
| 242 | _GL_CXXALIAS_RPL (tzset, void, (void)); | 257 | _GL_CXXALIAS_RPL (tzset, void, (void)); |
| 243 | # elif defined _WIN32 && !defined __CYGWIN__ | 258 | # elif defined _WIN32 && !defined __CYGWIN__ |
| 244 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 259 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| @@ -265,7 +280,6 @@ _GL_CXXALIAS_SYS (tzset, void, (void)); | |||
| 265 | # endif | 280 | # endif |
| 266 | _GL_CXXALIASWARN (tzset); | 281 | _GL_CXXALIASWARN (tzset); |
| 267 | # elif defined GNULIB_POSIXCHECK | 282 | # elif defined GNULIB_POSIXCHECK |
| 268 | # undef tzset | ||
| 269 | # if HAVE_RAW_DECL_TZSET | 283 | # if HAVE_RAW_DECL_TZSET |
| 270 | _GL_WARN_ON_USE (tzset, "tzset has portability problems - " | 284 | _GL_WARN_ON_USE (tzset, "tzset has portability problems - " |
| 271 | "use gnulib module tzset for portability"); | 285 | "use gnulib module tzset for portability"); |
| @@ -278,7 +292,7 @@ _GL_WARN_ON_USE (tzset, "tzset has portability problems - " | |||
| 278 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 292 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 279 | # define mktime rpl_mktime | 293 | # define mktime rpl_mktime |
| 280 | # endif | 294 | # endif |
| 281 | _GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1))); | 295 | _GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp), _GL_ARG_NONNULL ((1))); |
| 282 | _GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp)); | 296 | _GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp)); |
| 283 | # else | 297 | # else |
| 284 | _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp)); | 298 | _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp)); |
| @@ -287,7 +301,6 @@ _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp)); | |||
| 287 | _GL_CXXALIASWARN (mktime); | 301 | _GL_CXXALIASWARN (mktime); |
| 288 | # endif | 302 | # endif |
| 289 | # elif defined GNULIB_POSIXCHECK | 303 | # elif defined GNULIB_POSIXCHECK |
| 290 | # undef mktime | ||
| 291 | # if HAVE_RAW_DECL_MKTIME | 304 | # if HAVE_RAW_DECL_MKTIME |
| 292 | _GL_WARN_ON_USE (mktime, "mktime has portability problems - " | 305 | _GL_WARN_ON_USE (mktime, "mktime has portability problems - " |
| 293 | "use gnulib module mktime for portability"); | 306 | "use gnulib module mktime for portability"); |
| @@ -304,14 +317,14 @@ _GL_WARN_ON_USE (mktime, "mktime has portability problems - " | |||
| 304 | # define localtime_r rpl_localtime_r | 317 | # define localtime_r rpl_localtime_r |
| 305 | # endif | 318 | # endif |
| 306 | _GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, | 319 | _GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, |
| 307 | struct tm *restrict __result) | 320 | struct tm *restrict __result), |
| 308 | _GL_ARG_NONNULL ((1, 2))); | 321 | _GL_ARG_NONNULL ((1, 2))); |
| 309 | _GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, | 322 | _GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, |
| 310 | struct tm *restrict __result)); | 323 | struct tm *restrict __result)); |
| 311 | # else | 324 | # else |
| 312 | # if ! @HAVE_DECL_LOCALTIME_R@ | 325 | # if ! @HAVE_DECL_LOCALTIME_R@ |
| 313 | _GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, | 326 | _GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, |
| 314 | struct tm *restrict __result) | 327 | struct tm *restrict __result), |
| 315 | _GL_ARG_NONNULL ((1, 2))); | 328 | _GL_ARG_NONNULL ((1, 2))); |
| 316 | # endif | 329 | # endif |
| 317 | _GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, | 330 | _GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, |
| @@ -326,14 +339,14 @@ _GL_CXXALIASWARN (localtime_r); | |||
| 326 | # define gmtime_r rpl_gmtime_r | 339 | # define gmtime_r rpl_gmtime_r |
| 327 | # endif | 340 | # endif |
| 328 | _GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, | 341 | _GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, |
| 329 | struct tm *restrict __result) | 342 | struct tm *restrict __result), |
| 330 | _GL_ARG_NONNULL ((1, 2))); | 343 | _GL_ARG_NONNULL ((1, 2))); |
| 331 | _GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, | 344 | _GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, |
| 332 | struct tm *restrict __result)); | 345 | struct tm *restrict __result)); |
| 333 | # else | 346 | # else |
| 334 | # if ! @HAVE_DECL_LOCALTIME_R@ | 347 | # if ! @HAVE_DECL_LOCALTIME_R@ |
| 335 | _GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, | 348 | _GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, |
| 336 | struct tm *restrict __result) | 349 | struct tm *restrict __result), |
| 337 | _GL_ARG_NONNULL ((1, 2))); | 350 | _GL_ARG_NONNULL ((1, 2))); |
| 338 | # endif | 351 | # endif |
| 339 | _GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, | 352 | _GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, |
| @@ -343,12 +356,10 @@ _GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, | |||
| 343 | _GL_CXXALIASWARN (gmtime_r); | 356 | _GL_CXXALIASWARN (gmtime_r); |
| 344 | # endif | 357 | # endif |
| 345 | # elif defined GNULIB_POSIXCHECK | 358 | # elif defined GNULIB_POSIXCHECK |
| 346 | # undef localtime_r | ||
| 347 | # if HAVE_RAW_DECL_LOCALTIME_R | 359 | # if HAVE_RAW_DECL_LOCALTIME_R |
| 348 | _GL_WARN_ON_USE (localtime_r, "localtime_r is unportable - " | 360 | _GL_WARN_ON_USE (localtime_r, "localtime_r is unportable - " |
| 349 | "use gnulib module time_r for portability"); | 361 | "use gnulib module time_r for portability"); |
| 350 | # endif | 362 | # endif |
| 351 | # undef gmtime_r | ||
| 352 | # if HAVE_RAW_DECL_GMTIME_R | 363 | # if HAVE_RAW_DECL_GMTIME_R |
| 353 | _GL_WARN_ON_USE (gmtime_r, "gmtime_r is unportable - " | 364 | _GL_WARN_ON_USE (gmtime_r, "gmtime_r is unportable - " |
| 354 | "use gnulib module time_r for portability"); | 365 | "use gnulib module time_r for portability"); |
| @@ -364,7 +375,7 @@ _GL_WARN_ON_USE (gmtime_r, "gmtime_r is unportable - " | |||
| 364 | # undef localtime | 375 | # undef localtime |
| 365 | # define localtime rpl_localtime | 376 | # define localtime rpl_localtime |
| 366 | # endif | 377 | # endif |
| 367 | _GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer) | 378 | _GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer), |
| 368 | _GL_ARG_NONNULL ((1))); | 379 | _GL_ARG_NONNULL ((1))); |
| 369 | _GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer)); | 380 | _GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer)); |
| 370 | # else | 381 | # else |
| @@ -374,7 +385,6 @@ _GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer)); | |||
| 374 | _GL_CXXALIASWARN (localtime); | 385 | _GL_CXXALIASWARN (localtime); |
| 375 | # endif | 386 | # endif |
| 376 | # elif defined GNULIB_POSIXCHECK | 387 | # elif defined GNULIB_POSIXCHECK |
| 377 | # undef localtime | ||
| 378 | # if HAVE_RAW_DECL_LOCALTIME | 388 | # if HAVE_RAW_DECL_LOCALTIME |
| 379 | _GL_WARN_ON_USE (localtime, "localtime has portability problems - " | 389 | _GL_WARN_ON_USE (localtime, "localtime has portability problems - " |
| 380 | "use gnulib module localtime for portability"); | 390 | "use gnulib module localtime for portability"); |
| @@ -387,7 +397,7 @@ _GL_WARN_ON_USE (localtime, "localtime has portability problems - " | |||
| 387 | # undef gmtime | 397 | # undef gmtime |
| 388 | # define gmtime rpl_gmtime | 398 | # define gmtime rpl_gmtime |
| 389 | # endif | 399 | # endif |
| 390 | _GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer) | 400 | _GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer), |
| 391 | _GL_ARG_NONNULL ((1))); | 401 | _GL_ARG_NONNULL ((1))); |
| 392 | _GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer)); | 402 | _GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer)); |
| 393 | # else | 403 | # else |
| @@ -403,7 +413,7 @@ _GL_CXXALIASWARN (gmtime); | |||
| 403 | # if ! @HAVE_STRPTIME@ | 413 | # if ! @HAVE_STRPTIME@ |
| 404 | _GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf, | 414 | _GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf, |
| 405 | char const *restrict __format, | 415 | char const *restrict __format, |
| 406 | struct tm *restrict __tm) | 416 | struct tm *restrict __tm), |
| 407 | _GL_ARG_NONNULL ((1, 2, 3))); | 417 | _GL_ARG_NONNULL ((1, 2, 3))); |
| 408 | # endif | 418 | # endif |
| 409 | _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf, | 419 | _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf, |
| @@ -411,7 +421,6 @@ _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf, | |||
| 411 | struct tm *restrict __tm)); | 421 | struct tm *restrict __tm)); |
| 412 | _GL_CXXALIASWARN (strptime); | 422 | _GL_CXXALIASWARN (strptime); |
| 413 | # elif defined GNULIB_POSIXCHECK | 423 | # elif defined GNULIB_POSIXCHECK |
| 414 | # undef strptime | ||
| 415 | # if HAVE_RAW_DECL_STRPTIME | 424 | # if HAVE_RAW_DECL_STRPTIME |
| 416 | _GL_WARN_ON_USE (strptime, "strptime is unportable - " | 425 | _GL_WARN_ON_USE (strptime, "strptime is unportable - " |
| 417 | "use gnulib module strptime for portability"); | 426 | "use gnulib module strptime for portability"); |
| @@ -428,7 +437,7 @@ _GL_WARN_ON_USE (strptime, "strptime is unportable - " | |||
| 428 | # ifndef __cplusplus | 437 | # ifndef __cplusplus |
| 429 | _GL_ATTRIBUTE_DEPRECATED | 438 | _GL_ATTRIBUTE_DEPRECATED |
| 430 | # endif | 439 | # endif |
| 431 | _GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp) | 440 | _GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp), |
| 432 | _GL_ARG_NONNULL ((1))); | 441 | _GL_ARG_NONNULL ((1))); |
| 433 | _GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp)); | 442 | _GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp)); |
| 434 | # else | 443 | # else |
| @@ -450,7 +459,7 @@ _GL_CXXALIASWARN (ctime); | |||
| 450 | # endif | 459 | # endif |
| 451 | _GL_FUNCDECL_RPL (strftime, size_t, | 460 | _GL_FUNCDECL_RPL (strftime, size_t, |
| 452 | (char *restrict __buf, size_t __bufsize, | 461 | (char *restrict __buf, size_t __bufsize, |
| 453 | const char *restrict __fmt, const struct tm *restrict __tp) | 462 | const char *restrict __fmt, const struct tm *restrict __tp), |
| 454 | _GL_ARG_NONNULL ((1, 3, 4))); | 463 | _GL_ARG_NONNULL ((1, 3, 4))); |
| 455 | _GL_CXXALIAS_RPL (strftime, size_t, | 464 | _GL_CXXALIAS_RPL (strftime, size_t, |
| 456 | (char *restrict __buf, size_t __bufsize, | 465 | (char *restrict __buf, size_t __bufsize, |
| @@ -464,21 +473,30 @@ _GL_CXXALIAS_SYS (strftime, size_t, | |||
| 464 | _GL_CXXALIASWARN (strftime); | 473 | _GL_CXXALIASWARN (strftime); |
| 465 | # endif | 474 | # endif |
| 466 | # elif defined GNULIB_POSIXCHECK | 475 | # elif defined GNULIB_POSIXCHECK |
| 467 | # undef strftime | ||
| 468 | # if HAVE_RAW_DECL_STRFTIME | 476 | # if HAVE_RAW_DECL_STRFTIME |
| 469 | _GL_WARN_ON_USE (strftime, "strftime has portability problems - " | 477 | _GL_WARN_ON_USE (strftime, "strftime has portability problems - " |
| 470 | "use gnulib module strftime-fixes for portability"); | 478 | "use gnulib module strftime-fixes for portability"); |
| 471 | # endif | 479 | # endif |
| 472 | # endif | 480 | # endif |
| 473 | 481 | ||
| 474 | # if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@ | 482 | # if @GNULIB_TIME_RZ@ |
| 475 | /* Functions that use a first-class time zone data type, instead of | 483 | /* Functions that use a first-class time zone data type, instead of |
| 476 | relying on an implicit global time zone. | 484 | relying on an implicit global time zone. |
| 477 | Inspired by NetBSD. */ | 485 | Inspired by NetBSD. */ |
| 478 | 486 | ||
| 479 | /* Represents a time zone. | 487 | /* Represents a time zone. |
| 480 | (timezone_t) NULL stands for UTC. */ | 488 | (timezone_t) NULL stands for UTC. */ |
| 489 | # if !@HAVE_TZALLOC@ | ||
| 490 | # if !GNULIB_defined_timezone_t | ||
| 491 | # if !@HAVE_TIMEZONE_T@ | ||
| 481 | typedef struct tm_zone *timezone_t; | 492 | typedef struct tm_zone *timezone_t; |
| 493 | # else | ||
| 494 | typedef struct tm_zone *rpl_timezone_t; | ||
| 495 | # define timezone_t rpl_timezone_t | ||
| 496 | # endif | ||
| 497 | # define GNULIB_defined_timezone_t 1 | ||
| 498 | # endif | ||
| 499 | # endif | ||
| 482 | 500 | ||
| 483 | /* tzalloc (name) | 501 | /* tzalloc (name) |
| 484 | Returns a time zone object for the given time zone NAME. This object | 502 | Returns a time zone object for the given time zone NAME. This object |
| @@ -488,37 +506,79 @@ typedef struct tm_zone *timezone_t; | |||
| 488 | would use it the TZ environment variable was unset. | 506 | would use it the TZ environment variable was unset. |
| 489 | May return NULL if NAME is invalid (this is platform dependent) or | 507 | May return NULL if NAME is invalid (this is platform dependent) or |
| 490 | upon memory allocation failure. */ | 508 | upon memory allocation failure. */ |
| 491 | _GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name)); | 509 | # if !@HAVE_TZALLOC@ |
| 510 | _GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name), ); | ||
| 492 | _GL_CXXALIAS_SYS (tzalloc, timezone_t, (char const *__name)); | 511 | _GL_CXXALIAS_SYS (tzalloc, timezone_t, (char const *__name)); |
| 512 | # endif | ||
| 493 | 513 | ||
| 494 | /* tzfree (tz) | 514 | /* tzfree (tz) |
| 495 | Frees a time zone object. | 515 | Free a time zone object, preserving errno. |
| 496 | The argument must have been returned by tzalloc(). */ | 516 | The argument must have been returned by tzalloc(). */ |
| 497 | _GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz)); | 517 | # if !@HAVE_TZALLOC@ |
| 518 | _GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz), ); | ||
| 498 | _GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz)); | 519 | _GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz)); |
| 520 | # else | ||
| 521 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 522 | # undef tzfree | ||
| 523 | # define tzfree rpl_tzfree | ||
| 524 | # endif | ||
| 525 | _GL_FUNCDECL_RPL (tzfree, void, (timezone_t __tz), ); | ||
| 526 | _GL_CXXALIAS_RPL (tzfree, void, (timezone_t __tz)); | ||
| 527 | # endif | ||
| 499 | 528 | ||
| 500 | /* localtime_rz (tz, &t, &result) | 529 | /* localtime_rz (tz, &t, &result) |
| 501 | Converts an absolute time T to a broken-down time RESULT, assuming the | 530 | Converts an absolute time T to a broken-down time RESULT, assuming the |
| 502 | time zone TZ. | 531 | time zone TZ. |
| 503 | This function is like 'localtime_r', but relies on the argument TZ instead | 532 | This function is like 'localtime_r', but relies on the argument TZ instead |
| 504 | of an implicit global time zone. */ | 533 | of an implicit global time zone. */ |
| 534 | # if @REPLACE_LOCALTIME_RZ@ | ||
| 535 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 536 | # undef localtime_rz | ||
| 537 | # define localtime_rz rpl_localtime_rz | ||
| 538 | # endif | ||
| 539 | _GL_FUNCDECL_RPL (localtime_rz, struct tm *, | ||
| 540 | (timezone_t __tz, time_t const *restrict __timer, | ||
| 541 | struct tm *restrict __result), | ||
| 542 | _GL_ARG_NONNULL ((2, 3))); | ||
| 543 | _GL_CXXALIAS_RPL (localtime_rz, struct tm *, | ||
| 544 | (timezone_t __tz, time_t const *restrict __timer, | ||
| 545 | struct tm *restrict __result)); | ||
| 546 | # else | ||
| 547 | # if !@HAVE_TZALLOC@ | ||
| 505 | _GL_FUNCDECL_SYS (localtime_rz, struct tm *, | 548 | _GL_FUNCDECL_SYS (localtime_rz, struct tm *, |
| 506 | (timezone_t __tz, time_t const *restrict __timer, | 549 | (timezone_t __tz, time_t const *restrict __timer, |
| 507 | struct tm *restrict __result) _GL_ARG_NONNULL ((2, 3))); | 550 | struct tm *restrict __result), |
| 551 | _GL_ARG_NONNULL ((2, 3))); | ||
| 552 | # endif | ||
| 508 | _GL_CXXALIAS_SYS (localtime_rz, struct tm *, | 553 | _GL_CXXALIAS_SYS (localtime_rz, struct tm *, |
| 509 | (timezone_t __tz, time_t const *restrict __timer, | 554 | (timezone_t __tz, time_t const *restrict __timer, |
| 510 | struct tm *restrict __result)); | 555 | struct tm *restrict __result)); |
| 556 | # endif | ||
| 511 | 557 | ||
| 512 | /* mktime_z (tz, &tm) | 558 | /* mktime_z (tz, &tm) |
| 513 | Normalizes the broken-down time TM and converts it to an absolute time, | 559 | Normalizes the broken-down time TM and converts it to an absolute time, |
| 514 | assuming the time zone TZ. Returns the absolute time. | 560 | assuming the time zone TZ. Returns the absolute time. |
| 515 | This function is like 'mktime', but relies on the argument TZ instead | 561 | This function is like 'mktime', but relies on the argument TZ instead |
| 516 | of an implicit global time zone. */ | 562 | of an implicit global time zone. */ |
| 563 | # if @REPLACE_MKTIME_Z@ | ||
| 564 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 565 | # undef mktime_z | ||
| 566 | # define mktime_z rpl_mktime_z | ||
| 567 | # endif | ||
| 568 | _GL_FUNCDECL_RPL (mktime_z, time_t, | ||
| 569 | (timezone_t __tz, struct tm *restrict __tm), | ||
| 570 | _GL_ARG_NONNULL ((2))); | ||
| 571 | _GL_CXXALIAS_RPL (mktime_z, time_t, | ||
| 572 | (timezone_t __tz, struct tm *restrict __tm)); | ||
| 573 | # else | ||
| 574 | # if !@HAVE_TZALLOC@ | ||
| 517 | _GL_FUNCDECL_SYS (mktime_z, time_t, | 575 | _GL_FUNCDECL_SYS (mktime_z, time_t, |
| 518 | (timezone_t __tz, struct tm *restrict __tm) | 576 | (timezone_t __tz, struct tm *restrict __tm), |
| 519 | _GL_ARG_NONNULL ((2))); | 577 | _GL_ARG_NONNULL ((2))); |
| 578 | # endif | ||
| 520 | _GL_CXXALIAS_SYS (mktime_z, time_t, | 579 | _GL_CXXALIAS_SYS (mktime_z, time_t, |
| 521 | (timezone_t __tz, struct tm *restrict __tm)); | 580 | (timezone_t __tz, struct tm *restrict __tm)); |
| 581 | # endif | ||
| 522 | 582 | ||
| 523 | /* Time zone abbreviation strings (returned by 'localtime_rz' or 'mktime_z' | 583 | /* Time zone abbreviation strings (returned by 'localtime_rz' or 'mktime_z' |
| 524 | in the 'tm_zone' member of 'struct tm') are valid as long as | 584 | in the 'tm_zone' member of 'struct tm') are valid as long as |
| @@ -535,11 +595,11 @@ _GL_CXXALIAS_SYS (mktime_z, time_t, | |||
| 535 | # undef timegm | 595 | # undef timegm |
| 536 | # define timegm rpl_timegm | 596 | # define timegm rpl_timegm |
| 537 | # endif | 597 | # endif |
| 538 | _GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); | 598 | _GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm), _GL_ARG_NONNULL ((1))); |
| 539 | _GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm)); | 599 | _GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm)); |
| 540 | # else | 600 | # else |
| 541 | # if ! @HAVE_TIMEGM@ | 601 | # if ! @HAVE_TIMEGM@ |
| 542 | _GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); | 602 | _GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm), _GL_ARG_NONNULL ((1))); |
| 543 | # endif | 603 | # endif |
| 544 | _GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm)); | 604 | _GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm)); |
| 545 | # endif | 605 | # endif |
| @@ -547,7 +607,6 @@ _GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm)); | |||
| 547 | _GL_CXXALIASWARN (timegm); | 607 | _GL_CXXALIASWARN (timegm); |
| 548 | # endif | 608 | # endif |
| 549 | # elif defined GNULIB_POSIXCHECK | 609 | # elif defined GNULIB_POSIXCHECK |
| 550 | # undef timegm | ||
| 551 | # if HAVE_RAW_DECL_TIMEGM | 610 | # if HAVE_RAW_DECL_TIMEGM |
| 552 | _GL_WARN_ON_USE (timegm, "timegm is unportable - " | 611 | _GL_WARN_ON_USE (timegm, "timegm is unportable - " |
| 553 | "use gnulib module timegm for portability"); | 612 | "use gnulib module timegm for portability"); |
| @@ -558,28 +617,24 @@ _GL_WARN_ON_USE (timegm, "timegm is unportable - " | |||
| 558 | buffers when given outlandish struct tm values. Portable | 617 | buffers when given outlandish struct tm values. Portable |
| 559 | applications should use strftime (or even sprintf) instead. */ | 618 | applications should use strftime (or even sprintf) instead. */ |
| 560 | # if defined GNULIB_POSIXCHECK | 619 | # if defined GNULIB_POSIXCHECK |
| 561 | # undef asctime | ||
| 562 | # if HAVE_RAW_DECL_ASCTIME | 620 | # if HAVE_RAW_DECL_ASCTIME |
| 563 | _GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - " | 621 | _GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - " |
| 564 | "better use strftime (or even sprintf) instead"); | 622 | "better use strftime (or even sprintf) instead"); |
| 565 | # endif | 623 | # endif |
| 566 | # endif | 624 | # endif |
| 567 | # if defined GNULIB_POSIXCHECK | 625 | # if defined GNULIB_POSIXCHECK |
| 568 | # undef asctime_r | ||
| 569 | # if HAVE_RAW_DECL_ASCTIME_R | 626 | # if HAVE_RAW_DECL_ASCTIME_R |
| 570 | _GL_WARN_ON_USE (asctime_r, "asctime_r can overrun buffers in some cases - " | 627 | _GL_WARN_ON_USE (asctime_r, "asctime_r can overrun buffers in some cases - " |
| 571 | "better use strftime (or even sprintf) instead"); | 628 | "better use strftime (or even sprintf) instead"); |
| 572 | # endif | 629 | # endif |
| 573 | # endif | 630 | # endif |
| 574 | # if defined GNULIB_POSIXCHECK | 631 | # if defined GNULIB_POSIXCHECK |
| 575 | # undef ctime | ||
| 576 | # if HAVE_RAW_DECL_CTIME | 632 | # if HAVE_RAW_DECL_CTIME |
| 577 | _GL_WARN_ON_USE (ctime, "ctime can overrun buffers in some cases - " | 633 | _GL_WARN_ON_USE (ctime, "ctime can overrun buffers in some cases - " |
| 578 | "better use strftime (or even sprintf) instead"); | 634 | "better use strftime (or even sprintf) instead"); |
| 579 | # endif | 635 | # endif |
| 580 | # endif | 636 | # endif |
| 581 | # if defined GNULIB_POSIXCHECK | 637 | # if defined GNULIB_POSIXCHECK |
| 582 | # undef ctime_r | ||
| 583 | # if HAVE_RAW_DECL_CTIME_R | 638 | # if HAVE_RAW_DECL_CTIME_R |
| 584 | _GL_WARN_ON_USE (ctime_r, "ctime_r can overrun buffers in some cases - " | 639 | _GL_WARN_ON_USE (ctime_r, "ctime_r can overrun buffers in some cases - " |
| 585 | "better use strftime (or even sprintf) instead"); | 640 | "better use strftime (or even sprintf) instead"); |
