diff options
| author | Lorenz Kästle <lorenz.kaestle@netways.de> | 2023-03-09 11:03:48 +0100 |
|---|---|---|
| committer | Lorenz Kästle <lorenz.kaestle@netways.de> | 2023-03-09 11:03:48 +0100 |
| commit | d0edb72a0c9bc1a28197ab4566928f7ee63a6d43 (patch) | |
| tree | 6d524fb16d2dd1aa9f2d98529ef1de7a39f52700 /gl/time.in.h | |
| parent | 9fdc82f0543c6e2891c7079f70297f92e8ef4619 (diff) | |
| parent | 269718094177fb8a7e3d3005d1310495009fe8c4 (diff) | |
| download | monitoring-plugins-d0edb72.tar.gz | |
Merge branch 'master' into RincewindsHat-patch-1
Diffstat (limited to 'gl/time.in.h')
| -rw-r--r-- | gl/time.in.h | 273 |
1 files changed, 241 insertions, 32 deletions
diff --git a/gl/time.in.h b/gl/time.in.h index 8ced7947..50c9b30b 100644 --- a/gl/time.in.h +++ b/gl/time.in.h | |||
| @@ -1,19 +1,19 @@ | |||
| 1 | /* A more-standard <time.h>. | 1 | /* A more-standard <time.h>. |
| 2 | 2 | ||
| 3 | Copyright (C) 2007-2013 Free Software Foundation, Inc. | 3 | Copyright (C) 2007-2023 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This program 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 General Public License as published by | 6 | it under the terms of the GNU Lesser General Public License as |
| 7 | the Free Software Foundation; either version 3, or (at your option) | 7 | published by the Free Software Foundation; either version 2.1 of the |
| 8 | any later version. | 8 | License, or (at your option) any later version. |
| 9 | 9 | ||
| 10 | This program is distributed in the hope that it will be useful, | 10 | This file is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. | 13 | GNU Lesser General Public License for more details. |
| 14 | 14 | ||
| 15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Lesser General Public License |
| 16 | along with this program; if not, see <http://www.gnu.org/licenses/>. */ | 16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
| 17 | 17 | ||
| 18 | #if __GNUC__ >= 3 | 18 | #if __GNUC__ >= 3 |
| 19 | @PRAGMA_SYSTEM_HEADER@ | 19 | @PRAGMA_SYSTEM_HEADER@ |
| @@ -22,11 +22,13 @@ | |||
| 22 | 22 | ||
| 23 | /* Don't get in the way of glibc when it includes time.h merely to | 23 | /* Don't get in the way of glibc when it includes time.h merely to |
| 24 | declare a few standard symbols, rather than to declare all the | 24 | declare a few standard symbols, rather than to declare all the |
| 25 | symbols. Also, Solaris 8 <time.h> eventually includes itself | 25 | symbols. (However, skip this for MinGW as it treats __need_time_t |
| 26 | incompatibly.) Also, Solaris 8 <time.h> eventually includes itself | ||
| 26 | recursively; if that is happening, just include the system <time.h> | 27 | recursively; if that is happening, just include the system <time.h> |
| 27 | without adding our own declarations. */ | 28 | without adding our own declarations. */ |
| 28 | #if (defined __need_time_t || defined __need_clock_t \ | 29 | #if (((defined __need_time_t || defined __need_clock_t \ |
| 29 | || defined __need_timespec \ | 30 | || defined __need_timespec) \ |
| 31 | && !defined __MINGW32__) \ | ||
| 30 | || defined _@GUARD_PREFIX@_TIME_H) | 32 | || defined _@GUARD_PREFIX@_TIME_H) |
| 31 | 33 | ||
| 32 | # @INCLUDE_NEXT@ @NEXT_TIME_H@ | 34 | # @INCLUDE_NEXT@ @NEXT_TIME_H@ |
| @@ -35,6 +37,12 @@ | |||
| 35 | 37 | ||
| 36 | # define _@GUARD_PREFIX@_TIME_H | 38 | # define _@GUARD_PREFIX@_TIME_H |
| 37 | 39 | ||
| 40 | /* mingw's <time.h> provides the functions asctime_r, ctime_r, gmtime_r, | ||
| 41 | localtime_r only if <unistd.h> or <pthread.h> has been included before. */ | ||
| 42 | # if defined __MINGW32__ | ||
| 43 | # include <unistd.h> | ||
| 44 | # endif | ||
| 45 | |||
| 38 | # @INCLUDE_NEXT@ @NEXT_TIME_H@ | 46 | # @INCLUDE_NEXT@ @NEXT_TIME_H@ |
| 39 | 47 | ||
| 40 | /* NetBSD 5.0 mis-defines NULL. */ | 48 | /* NetBSD 5.0 mis-defines NULL. */ |
| @@ -46,22 +54,17 @@ | |||
| 46 | 54 | ||
| 47 | /* The definition of _GL_WARN_ON_USE is copied here. */ | 55 | /* The definition of _GL_WARN_ON_USE is copied here. */ |
| 48 | 56 | ||
| 49 | /* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3). | 57 | /* Some systems don't define struct timespec (e.g., AIX 4.1). |
| 50 | Or they define it with the wrong member names or define it in <sys/time.h> | 58 | Or they define it with the wrong member names or define it in <sys/time.h> |
| 51 | (e.g., FreeBSD circa 1997). Stock Mingw does not define it, but the | 59 | (e.g., FreeBSD circa 1997). Stock Mingw prior to 3.0 does not define it, |
| 52 | pthreads-win32 library defines it in <pthread.h>. */ | 60 | but the pthreads-win32 library defines it in <pthread.h>. */ |
| 53 | # if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@ | 61 | # if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@ |
| 54 | # if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ | 62 | # if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ |
| 55 | # include <sys/time.h> | 63 | # include <sys/time.h> |
| 56 | # elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ | 64 | # elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ |
| 57 | # include <pthread.h> | 65 | # include <pthread.h> |
| 58 | /* The pthreads-win32 <pthread.h> also defines a couple of broken macros. */ | 66 | # elif @UNISTD_H_DEFINES_STRUCT_TIMESPEC@ |
| 59 | # undef asctime_r | 67 | # include <unistd.h> |
| 60 | # undef ctime_r | ||
| 61 | # undef gmtime_r | ||
| 62 | # undef localtime_r | ||
| 63 | # undef rand_r | ||
| 64 | # undef strtok_r | ||
| 65 | # else | 68 | # else |
| 66 | 69 | ||
| 67 | # ifdef __cplusplus | 70 | # ifdef __cplusplus |
| @@ -87,8 +90,8 @@ struct timespec | |||
| 87 | # endif | 90 | # endif |
| 88 | 91 | ||
| 89 | # if !GNULIB_defined_struct_time_t_must_be_integral | 92 | # if !GNULIB_defined_struct_time_t_must_be_integral |
| 90 | /* Per http://austingroupbugs.net/view.php?id=327, POSIX requires | 93 | /* https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html |
| 91 | time_t to be an integer type, even though C99 permits floating | 94 | requires time_t to be an integer type, even though C99 permits floating |
| 92 | point. We don't know of any implementation that uses floating | 95 | point. We don't know of any implementation that uses floating |
| 93 | point, and it is much easier to write code that doesn't have to | 96 | point, and it is much easier to write code that doesn't have to |
| 94 | worry about that corner case, so we force the issue. */ | 97 | worry about that corner case, so we force the issue. */ |
| @@ -98,9 +101,39 @@ struct __time_t_must_be_integral { | |||
| 98 | # define GNULIB_defined_struct_time_t_must_be_integral 1 | 101 | # define GNULIB_defined_struct_time_t_must_be_integral 1 |
| 99 | # endif | 102 | # endif |
| 100 | 103 | ||
| 104 | /* Define TIME_UTC, a positive integer constant used for timespec_get(). */ | ||
| 105 | # if ! @TIME_H_DEFINES_TIME_UTC@ | ||
| 106 | # if !GNULIB_defined_TIME_UTC | ||
| 107 | # define TIME_UTC 1 | ||
| 108 | # define GNULIB_defined_TIME_UTC 1 | ||
| 109 | # endif | ||
| 110 | # endif | ||
| 111 | |||
| 112 | /* Set *TS to the current time, and return BASE. | ||
| 113 | Upon failure, return 0. */ | ||
| 114 | # if @GNULIB_TIMESPEC_GET@ | ||
| 115 | # if ! @HAVE_TIMESPEC_GET@ | ||
| 116 | _GL_FUNCDECL_SYS (timespec_get, int, (struct timespec *ts, int base) | ||
| 117 | _GL_ARG_NONNULL ((1))); | ||
| 118 | # endif | ||
| 119 | _GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, int base)); | ||
| 120 | _GL_CXXALIASWARN (timespec_get); | ||
| 121 | # endif | ||
| 122 | |||
| 123 | /* Set *TS to the current time resolution, and return BASE. | ||
| 124 | Upon failure, return 0. */ | ||
| 125 | # if @GNULIB_TIMESPEC_GETRES@ | ||
| 126 | # if ! @HAVE_TIMESPEC_GETRES@ | ||
| 127 | _GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base) | ||
| 128 | _GL_ARG_NONNULL ((1))); | ||
| 129 | # endif | ||
| 130 | _GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base)); | ||
| 131 | _GL_CXXALIASWARN (timespec_getres); | ||
| 132 | # endif | ||
| 133 | |||
| 101 | /* Sleep for at least RQTP seconds unless interrupted, If interrupted, | 134 | /* Sleep for at least RQTP seconds unless interrupted, If interrupted, |
| 102 | return -1 and store the remaining time into RMTP. See | 135 | return -1 and store the remaining time into RMTP. See |
| 103 | <http://www.opengroup.org/susv3xsh/nanosleep.html>. */ | 136 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/nanosleep.html>. */ |
| 104 | # if @GNULIB_NANOSLEEP@ | 137 | # if @GNULIB_NANOSLEEP@ |
| 105 | # if @REPLACE_NANOSLEEP@ | 138 | # if @REPLACE_NANOSLEEP@ |
| 106 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 139 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| @@ -123,6 +156,41 @@ _GL_CXXALIAS_SYS (nanosleep, int, | |||
| 123 | _GL_CXXALIASWARN (nanosleep); | 156 | _GL_CXXALIASWARN (nanosleep); |
| 124 | # endif | 157 | # endif |
| 125 | 158 | ||
| 159 | /* Initialize time conversion information. */ | ||
| 160 | # if @GNULIB_TZSET@ | ||
| 161 | # if @REPLACE_TZSET@ | ||
| 162 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 163 | # undef tzset | ||
| 164 | # define tzset rpl_tzset | ||
| 165 | # endif | ||
| 166 | _GL_FUNCDECL_RPL (tzset, void, (void)); | ||
| 167 | _GL_CXXALIAS_RPL (tzset, void, (void)); | ||
| 168 | # elif defined _WIN32 && !defined __CYGWIN__ | ||
| 169 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 170 | # undef tzset | ||
| 171 | # define tzset _tzset | ||
| 172 | # endif | ||
| 173 | _GL_CXXALIAS_MDA (tzset, void, (void)); | ||
| 174 | # else | ||
| 175 | _GL_CXXALIAS_SYS (tzset, void, (void)); | ||
| 176 | # endif | ||
| 177 | _GL_CXXALIASWARN (tzset); | ||
| 178 | # elif @GNULIB_MDA_TZSET@ | ||
| 179 | /* On native Windows, map 'tzset' to '_tzset', so that -loldnames is not | ||
| 180 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
| 181 | platforms by defining GNULIB_NAMESPACE::tzset always. */ | ||
| 182 | # if defined _WIN32 && !defined __CYGWIN__ | ||
| 183 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 184 | # undef tzset | ||
| 185 | # define tzset _tzset | ||
| 186 | # endif | ||
| 187 | _GL_CXXALIAS_MDA (tzset, void, (void)); | ||
| 188 | # else | ||
| 189 | _GL_CXXALIAS_SYS (tzset, void, (void)); | ||
| 190 | # endif | ||
| 191 | _GL_CXXALIASWARN (tzset); | ||
| 192 | # endif | ||
| 193 | |||
| 126 | /* Return the 'time_t' representation of TP and normalize TP. */ | 194 | /* Return the 'time_t' representation of TP and normalize TP. */ |
| 127 | # if @GNULIB_MKTIME@ | 195 | # if @GNULIB_MKTIME@ |
| 128 | # if @REPLACE_MKTIME@ | 196 | # if @REPLACE_MKTIME@ |
| @@ -134,12 +202,14 @@ _GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp)); | |||
| 134 | # else | 202 | # else |
| 135 | _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp)); | 203 | _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp)); |
| 136 | # endif | 204 | # endif |
| 205 | # if __GLIBC__ >= 2 | ||
| 137 | _GL_CXXALIASWARN (mktime); | 206 | _GL_CXXALIASWARN (mktime); |
| 207 | # endif | ||
| 138 | # endif | 208 | # endif |
| 139 | 209 | ||
| 140 | /* Convert TIMER to RESULT, assuming local time and UTC respectively. See | 210 | /* Convert TIMER to RESULT, assuming local time and UTC respectively. See |
| 141 | <http://www.opengroup.org/susv3xsh/localtime_r.html> and | 211 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/localtime_r.html> and |
| 142 | <http://www.opengroup.org/susv3xsh/gmtime_r.html>. */ | 212 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/gmtime_r.html>. */ |
| 143 | # if @GNULIB_TIME_R@ | 213 | # if @GNULIB_TIME_R@ |
| 144 | # if @REPLACE_LOCALTIME_R@ | 214 | # if @REPLACE_LOCALTIME_R@ |
| 145 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 215 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| @@ -187,9 +257,44 @@ _GL_CXXALIASWARN (gmtime_r); | |||
| 187 | # endif | 257 | # endif |
| 188 | # endif | 258 | # endif |
| 189 | 259 | ||
| 190 | /* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store | 260 | /* Convert TIMER to RESULT, assuming local time and UTC respectively. See |
| 261 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/localtime.html> and | ||
| 262 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/gmtime.html>. */ | ||
| 263 | # if @GNULIB_LOCALTIME@ || @REPLACE_LOCALTIME@ | ||
| 264 | # if @REPLACE_LOCALTIME@ | ||
| 265 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 266 | # undef localtime | ||
| 267 | # define localtime rpl_localtime | ||
| 268 | # endif | ||
| 269 | _GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer) | ||
| 270 | _GL_ARG_NONNULL ((1))); | ||
| 271 | _GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer)); | ||
| 272 | # else | ||
| 273 | _GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer)); | ||
| 274 | # endif | ||
| 275 | # if __GLIBC__ >= 2 | ||
| 276 | _GL_CXXALIASWARN (localtime); | ||
| 277 | # endif | ||
| 278 | # endif | ||
| 279 | |||
| 280 | # if 0 || @REPLACE_GMTIME@ | ||
| 281 | # if @REPLACE_GMTIME@ | ||
| 282 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 283 | # undef gmtime | ||
| 284 | # define gmtime rpl_gmtime | ||
| 285 | # endif | ||
| 286 | _GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer) | ||
| 287 | _GL_ARG_NONNULL ((1))); | ||
| 288 | _GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer)); | ||
| 289 | # else | ||
| 290 | _GL_CXXALIAS_SYS (gmtime, struct tm *, (time_t const *__timer)); | ||
| 291 | # endif | ||
| 292 | _GL_CXXALIASWARN (gmtime); | ||
| 293 | # endif | ||
| 294 | |||
| 295 | /* Parse BUF as a timestamp, assuming FORMAT specifies its layout, and store | ||
| 191 | the resulting broken-down time into TM. See | 296 | the resulting broken-down time into TM. See |
| 192 | <http://www.opengroup.org/susv3xsh/strptime.html>. */ | 297 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/strptime.html>. */ |
| 193 | # if @GNULIB_STRPTIME@ | 298 | # if @GNULIB_STRPTIME@ |
| 194 | # if ! @HAVE_STRPTIME@ | 299 | # if ! @HAVE_STRPTIME@ |
| 195 | _GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf, | 300 | _GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf, |
| @@ -203,6 +308,106 @@ _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf, | |||
| 203 | _GL_CXXALIASWARN (strptime); | 308 | _GL_CXXALIASWARN (strptime); |
| 204 | # endif | 309 | # endif |
| 205 | 310 | ||
| 311 | /* Convert *TP to a date and time string. See | ||
| 312 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/ctime.html>. */ | ||
| 313 | # if @GNULIB_CTIME@ | ||
| 314 | # if @REPLACE_CTIME@ | ||
| 315 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 316 | # define ctime rpl_ctime | ||
| 317 | # endif | ||
| 318 | _GL_ATTRIBUTE_DEPRECATED | ||
| 319 | _GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp) | ||
| 320 | _GL_ARG_NONNULL ((1))); | ||
| 321 | _GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp)); | ||
| 322 | # else | ||
| 323 | _GL_CXXALIAS_SYS (ctime, char *, (time_t const *__tp)); | ||
| 324 | # endif | ||
| 325 | # if __GLIBC__ >= 2 | ||
| 326 | _GL_CXXALIASWARN (ctime); | ||
| 327 | # endif | ||
| 328 | # endif | ||
| 329 | |||
| 330 | /* Convert *TP to a date and time string. See | ||
| 331 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html>. */ | ||
| 332 | # if @GNULIB_STRFTIME@ | ||
| 333 | # if @REPLACE_STRFTIME@ | ||
| 334 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 335 | # define strftime rpl_strftime | ||
| 336 | # endif | ||
| 337 | _GL_FUNCDECL_RPL (strftime, size_t, | ||
| 338 | (char *restrict __buf, size_t __bufsize, | ||
| 339 | const char *restrict __fmt, const struct tm *restrict __tp) | ||
| 340 | _GL_ARG_NONNULL ((1, 3, 4))); | ||
| 341 | _GL_CXXALIAS_RPL (strftime, size_t, | ||
| 342 | (char *restrict __buf, size_t __bufsize, | ||
| 343 | const char *restrict __fmt, const struct tm *restrict __tp)); | ||
| 344 | # else | ||
| 345 | _GL_CXXALIAS_SYS (strftime, size_t, | ||
| 346 | (char *restrict __buf, size_t __bufsize, | ||
| 347 | const char *restrict __fmt, const struct tm *restrict __tp)); | ||
| 348 | # endif | ||
| 349 | # if __GLIBC__ >= 2 | ||
| 350 | _GL_CXXALIASWARN (strftime); | ||
| 351 | # endif | ||
| 352 | # endif | ||
| 353 | |||
| 354 | # if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@ | ||
| 355 | /* Functions that use a first-class time zone data type, instead of | ||
| 356 | relying on an implicit global time zone. | ||
| 357 | Inspired by NetBSD. */ | ||
| 358 | |||
| 359 | /* Represents a time zone. | ||
| 360 | (timezone_t) NULL stands for UTC. */ | ||
| 361 | typedef struct tm_zone *timezone_t; | ||
| 362 | |||
| 363 | /* tzalloc (name) | ||
| 364 | Returns a time zone object for the given time zone NAME. This object | ||
| 365 | represents the time zone that other functions would use it the TZ | ||
| 366 | environment variable was set to NAME. | ||
| 367 | If NAME is NULL, the result represents the time zone that other functions | ||
| 368 | would use it the TZ environment variable was unset. | ||
| 369 | May return NULL if NAME is invalid (this is platform dependent) or | ||
| 370 | upon memory allocation failure. */ | ||
| 371 | _GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name)); | ||
| 372 | _GL_CXXALIAS_SYS (tzalloc, timezone_t, (char const *__name)); | ||
| 373 | |||
| 374 | /* tzfree (tz) | ||
| 375 | Frees a time zone object. | ||
| 376 | The argument must have been returned by tzalloc(). */ | ||
| 377 | _GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz)); | ||
| 378 | _GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz)); | ||
| 379 | |||
| 380 | /* localtime_rz (tz, &t, &result) | ||
| 381 | Converts an absolute time T to a broken-down time RESULT, assuming the | ||
| 382 | time zone TZ. | ||
| 383 | This function is like 'localtime_r', but relies on the argument TZ instead | ||
| 384 | of an implicit global time zone. */ | ||
| 385 | _GL_FUNCDECL_SYS (localtime_rz, struct tm *, | ||
| 386 | (timezone_t __tz, time_t const *restrict __timer, | ||
| 387 | struct tm *restrict __result) _GL_ARG_NONNULL ((2, 3))); | ||
| 388 | _GL_CXXALIAS_SYS (localtime_rz, struct tm *, | ||
| 389 | (timezone_t __tz, time_t const *restrict __timer, | ||
| 390 | struct tm *restrict __result)); | ||
| 391 | |||
| 392 | /* mktime_z (tz, &tm) | ||
| 393 | Normalizes the broken-down time TM and converts it to an absolute time, | ||
| 394 | assuming the time zone TZ. Returns the absolute time. | ||
| 395 | This function is like 'mktime', but relies on the argument TZ instead | ||
| 396 | of an implicit global time zone. */ | ||
| 397 | _GL_FUNCDECL_SYS (mktime_z, time_t, | ||
| 398 | (timezone_t __tz, struct tm *restrict __tm) | ||
| 399 | _GL_ARG_NONNULL ((2))); | ||
| 400 | _GL_CXXALIAS_SYS (mktime_z, time_t, | ||
| 401 | (timezone_t __tz, struct tm *restrict __tm)); | ||
| 402 | |||
| 403 | /* Time zone abbreviation strings (returned by 'localtime_rz' or 'mktime_z' | ||
| 404 | in the 'tm_zone' member of 'struct tm') are valid as long as | ||
| 405 | - the 'struct tm' argument is not destroyed or overwritten, | ||
| 406 | and | ||
| 407 | - the 'timezone_t' argument is not freed through tzfree(). */ | ||
| 408 | |||
| 409 | # endif | ||
| 410 | |||
| 206 | /* Convert TM to a time_t value, assuming UTC. */ | 411 | /* Convert TM to a time_t value, assuming UTC. */ |
| 207 | # if @GNULIB_TIMEGM@ | 412 | # if @GNULIB_TIMEGM@ |
| 208 | # if @REPLACE_TIMEGM@ | 413 | # if @REPLACE_TIMEGM@ |
| @@ -231,18 +436,22 @@ _GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - " | |||
| 231 | # endif | 436 | # endif |
| 232 | # if defined GNULIB_POSIXCHECK | 437 | # if defined GNULIB_POSIXCHECK |
| 233 | # undef asctime_r | 438 | # undef asctime_r |
| 234 | _GL_WARN_ON_USE (asctime, "asctime_r can overrun buffers in some cases - " | 439 | # if HAVE_RAW_DECL_ASCTIME_R |
| 440 | _GL_WARN_ON_USE (asctime_r, "asctime_r can overrun buffers in some cases - " | ||
| 235 | "better use strftime (or even sprintf) instead"); | 441 | "better use strftime (or even sprintf) instead"); |
| 442 | # endif | ||
| 236 | # endif | 443 | # endif |
| 237 | # if defined GNULIB_POSIXCHECK | 444 | # if defined GNULIB_POSIXCHECK |
| 238 | # undef ctime | 445 | # undef ctime |
| 239 | _GL_WARN_ON_USE (asctime, "ctime can overrun buffers in some cases - " | 446 | _GL_WARN_ON_USE (ctime, "ctime can overrun buffers in some cases - " |
| 240 | "better use strftime (or even sprintf) instead"); | 447 | "better use strftime (or even sprintf) instead"); |
| 241 | # endif | 448 | # endif |
| 242 | # if defined GNULIB_POSIXCHECK | 449 | # if defined GNULIB_POSIXCHECK |
| 243 | # undef ctime_r | 450 | # undef ctime_r |
| 244 | _GL_WARN_ON_USE (asctime, "ctime_r can overrun buffers in some cases - " | 451 | # if HAVE_RAW_DECL_CTIME_R |
| 452 | _GL_WARN_ON_USE (ctime_r, "ctime_r can overrun buffers in some cases - " | ||
| 245 | "better use strftime (or even sprintf) instead"); | 453 | "better use strftime (or even sprintf) instead"); |
| 454 | # endif | ||
| 246 | # endif | 455 | # endif |
| 247 | 456 | ||
| 248 | #endif | 457 | #endif |
