version 1.1.1.1, 2012/05/29 09:29:43
|
version 1.1.1.2, 2021/03/17 13:38:46
|
Line 1
|
Line 1
|
/* A more-standard <time.h>. |
/* A more-standard <time.h>. |
|
|
Copyright (C) 2007-2011 Free Software Foundation, Inc. | Copyright (C) 2007-2019 Free Software Foundation, Inc. |
|
|
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
Line 13
|
Line 13
|
GNU General Public License for more details. |
GNU General Public License for more details. |
|
|
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
along with this program; if not, write to the Free Software Foundation, | along with this program; if not, see <https://www.gnu.org/licenses/>. */ |
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | |
|
|
#if __GNUC__ >= 3 |
#if __GNUC__ >= 3 |
@PRAGMA_SYSTEM_HEADER@ |
@PRAGMA_SYSTEM_HEADER@ |
Line 23
|
Line 22
|
|
|
/* Don't get in the way of glibc when it includes time.h merely to |
/* Don't get in the way of glibc when it includes time.h merely to |
declare a few standard symbols, rather than to declare all the |
declare a few standard symbols, rather than to declare all the |
symbols. Also, Solaris 8 <time.h> eventually includes itself | symbols. (However, skip this for MinGW as it treats __need_time_t |
| incompatibly.) Also, Solaris 8 <time.h> eventually includes itself |
recursively; if that is happening, just include the system <time.h> |
recursively; if that is happening, just include the system <time.h> |
without adding our own declarations. */ |
without adding our own declarations. */ |
#if (defined __need_time_t || defined __need_clock_t \ | #if (((defined __need_time_t || defined __need_clock_t \ |
|| defined __need_timespec \ | || defined __need_timespec) \ |
| && !defined __MINGW32__) \ |
|| defined _@GUARD_PREFIX@_TIME_H) |
|| defined _@GUARD_PREFIX@_TIME_H) |
|
|
# @INCLUDE_NEXT@ @NEXT_TIME_H@ |
# @INCLUDE_NEXT@ @NEXT_TIME_H@ |
Line 47
|
Line 48
|
|
|
/* The definition of _GL_WARN_ON_USE is copied here. */ |
/* The definition of _GL_WARN_ON_USE is copied here. */ |
|
|
/* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3). | /* Some systems don't define struct timespec (e.g., AIX 4.1). |
Or they define it with the wrong member names or define it in <sys/time.h> |
Or they define it with the wrong member names or define it in <sys/time.h> |
(e.g., FreeBSD circa 1997). Stock Mingw does not define it, but the | (e.g., FreeBSD circa 1997). Stock Mingw prior to 3.0 does not define it, |
pthreads-win32 library defines it in <pthread.h>. */ | but the pthreads-win32 library defines it in <pthread.h>. */ |
# if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@ |
# if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@ |
# if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ |
# if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ |
# include <sys/time.h> |
# include <sys/time.h> |
# elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ |
# elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ |
# include <pthread.h> |
# include <pthread.h> |
/* The pthreads-win32 <pthread.h> also defines a couple of broken macros. */ | # elif @UNISTD_H_DEFINES_STRUCT_TIMESPEC@ |
# undef asctime_r | # include <unistd.h> |
# undef ctime_r | |
# undef gmtime_r | |
# undef localtime_r | |
# undef rand_r | |
# undef strtok_r | |
# else |
# else |
|
|
# ifdef __cplusplus |
# ifdef __cplusplus |
Line 124 _GL_CXXALIAS_SYS (nanosleep, int,
|
Line 120 _GL_CXXALIAS_SYS (nanosleep, int,
|
_GL_CXXALIASWARN (nanosleep); |
_GL_CXXALIASWARN (nanosleep); |
# endif |
# endif |
|
|
|
/* Initialize time conversion information. */ |
|
# if @GNULIB_TZSET@ |
|
# if @REPLACE_TZSET@ |
|
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
|
# undef tzset |
|
# define tzset rpl_tzset |
|
# endif |
|
_GL_FUNCDECL_RPL (tzset, void, (void)); |
|
_GL_CXXALIAS_RPL (tzset, void, (void)); |
|
# else |
|
# if ! @HAVE_TZSET@ |
|
_GL_FUNCDECL_SYS (tzset, void, (void)); |
|
# endif |
|
_GL_CXXALIAS_SYS (tzset, void, (void)); |
|
# endif |
|
_GL_CXXALIASWARN (tzset); |
|
# endif |
|
|
/* Return the 'time_t' representation of TP and normalize TP. */ |
/* Return the 'time_t' representation of TP and normalize TP. */ |
# if @GNULIB_MKTIME@ |
# if @GNULIB_MKTIME@ |
# if @REPLACE_MKTIME@ |
# if @REPLACE_MKTIME@ |
Line 188 _GL_CXXALIASWARN (gmtime_r);
|
Line 202 _GL_CXXALIASWARN (gmtime_r);
|
# endif |
# endif |
# endif |
# endif |
|
|
/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store | /* Convert TIMER to RESULT, assuming local time and UTC respectively. See |
| <http://www.opengroup.org/susv3xsh/localtime.html> and |
| <http://www.opengroup.org/susv3xsh/gmtime.html>. */ |
| # if @GNULIB_LOCALTIME@ || @REPLACE_LOCALTIME@ |
| # if @REPLACE_LOCALTIME@ |
| # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| # undef localtime |
| # define localtime rpl_localtime |
| # endif |
| _GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer) |
| _GL_ARG_NONNULL ((1))); |
| _GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer)); |
| # else |
| _GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer)); |
| # endif |
| _GL_CXXALIASWARN (localtime); |
| # endif |
| |
| # if 0 || @REPLACE_GMTIME@ |
| # if @REPLACE_GMTIME@ |
| # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| # undef gmtime |
| # define gmtime rpl_gmtime |
| # endif |
| _GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer) |
| _GL_ARG_NONNULL ((1))); |
| _GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer)); |
| # else |
| _GL_CXXALIAS_SYS (gmtime, struct tm *, (time_t const *__timer)); |
| # endif |
| _GL_CXXALIASWARN (gmtime); |
| # endif |
| |
| /* Parse BUF as a timestamp, assuming FORMAT specifies its layout, and store |
the resulting broken-down time into TM. See |
the resulting broken-down time into TM. See |
<http://www.opengroup.org/susv3xsh/strptime.html>. */ |
<http://www.opengroup.org/susv3xsh/strptime.html>. */ |
# if @GNULIB_STRPTIME@ |
# if @GNULIB_STRPTIME@ |
Line 202 _GL_CXXALIAS_SYS (strptime, char *, (char const *restr
|
Line 249 _GL_CXXALIAS_SYS (strptime, char *, (char const *restr
|
char const *restrict __format, |
char const *restrict __format, |
struct tm *restrict __tm)); |
struct tm *restrict __tm)); |
_GL_CXXALIASWARN (strptime); |
_GL_CXXALIASWARN (strptime); |
|
# endif |
|
|
|
/* Convert *TP to a date and time string. See |
|
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/ctime.html>. */ |
|
# if @GNULIB_CTIME@ |
|
# if @REPLACE_CTIME@ |
|
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
|
# define ctime rpl_ctime |
|
# endif |
|
_GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp) |
|
_GL_ARG_NONNULL ((1))); |
|
_GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp)); |
|
# else |
|
_GL_CXXALIAS_SYS (ctime, char *, (time_t const *__tp)); |
|
# endif |
|
_GL_CXXALIASWARN (ctime); |
|
# endif |
|
|
|
/* Convert *TP to a date and time string. See |
|
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html>. */ |
|
# if @GNULIB_STRFTIME@ |
|
# if @REPLACE_STRFTIME@ |
|
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
|
# define strftime rpl_strftime |
|
# endif |
|
_GL_FUNCDECL_RPL (strftime, size_t, (char *__buf, size_t __bufsize, |
|
const char *__fmt, const struct tm *__tp) |
|
_GL_ARG_NONNULL ((1, 3, 4))); |
|
_GL_CXXALIAS_RPL (strftime, size_t, (char *__buf, size_t __bufsize, |
|
const char *__fmt, const struct tm *__tp)); |
|
# else |
|
_GL_CXXALIAS_SYS (strftime, size_t, (char *__buf, size_t __bufsize, |
|
const char *__fmt, const struct tm *__tp)); |
|
# endif |
|
_GL_CXXALIASWARN (strftime); |
|
# endif |
|
|
|
# if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@ |
|
typedef struct tm_zone *timezone_t; |
|
_GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name)); |
|
_GL_CXXALIAS_SYS (tzalloc, timezone_t, (char const *__name)); |
|
_GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz)); |
|
_GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz)); |
|
_GL_FUNCDECL_SYS (localtime_rz, struct tm *, |
|
(timezone_t __tz, time_t const *restrict __timer, |
|
struct tm *restrict __result) _GL_ARG_NONNULL ((2, 3))); |
|
_GL_CXXALIAS_SYS (localtime_rz, struct tm *, |
|
(timezone_t __tz, time_t const *restrict __timer, |
|
struct tm *restrict __result)); |
|
_GL_FUNCDECL_SYS (mktime_z, time_t, |
|
(timezone_t __tz, struct tm *restrict __result) |
|
_GL_ARG_NONNULL ((2))); |
|
_GL_CXXALIAS_SYS (mktime_z, time_t, |
|
(timezone_t __tz, struct tm *restrict __result)); |
# endif |
# endif |
|
|
/* Convert TM to a time_t value, assuming UTC. */ |
/* Convert TM to a time_t value, assuming UTC. */ |