X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Ftime_.h;h=4d5cab8dafae71e09edf90e1e44ee1f34d8859fc;hb=d90f751e2a857949f6eca74876dc0921bffa01d9;hp=efc3d3b8d6d98d7727911b6de0f7c9a8d6a22ee4;hpb=f54e3e730aeea7226384d29ffe4310187048cd9a;p=gnulib.git diff --git a/lib/time_.h b/lib/time_.h index efc3d3b8d..4d5cab8da 100644 --- a/lib/time_.h +++ b/lib/time_.h @@ -18,100 +18,97 @@ /* 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 - symbols. */ -#if defined __need_time_t || defined __need_clock_t || defined __need_timespec + symbols. Also, Solaris 8 eventually includes itself + recursively; if that is happening, just include the system + without adding our own declarations. */ +#if (defined __need_time_t || defined __need_clock_t \ + || defined __need_timespec \ + || defined _GL_TIME_H) # @INCLUDE_NEXT@ @NEXT_TIME_H@ #else -/* Normal invocation convention. */ -# if ! defined _GL_TIME_H +# define _GL_TIME_H -/* The include_next requires a split double-inclusion guard. */ -# @INCLUDE_NEXT@ @NEXT_TIME_H@ - -# if ! defined _GL_TIME_H -# define _GL_TIME_H +# @INCLUDE_NEXT@ @NEXT_TIME_H@ -# ifdef __cplusplus +# ifdef __cplusplus extern "C" { -# endif +# endif /* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3). Or they define it with the wrong member names or define it in (e.g., FreeBSD circa 1997). */ -# if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@ -# if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ -# include -# else -# undef timespec -# define timespec rpl_timespec +# if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@ +# if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ +# include +# else +# undef timespec +# define timespec rpl_timespec struct timespec { time_t tv_sec; long int tv_nsec; }; -# endif -# endif +# endif +# endif /* Sleep for at least RQTP seconds unless interrupted, If interrupted, return -1 and store the remaining time into RMTP. See . */ -# if @REPLACE_NANOSLEEP@ -# define nanosleep rpl_nanosleep +# if @REPLACE_NANOSLEEP@ +# define nanosleep rpl_nanosleep int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp); -# endif +# endif /* Convert TIMER to RESULT, assuming local time and UTC respectively. See and . */ -# if @REPLACE_LOCALTIME_R@ -# undef localtime_r -# define localtime_r rpl_localtime_r -# undef gmtime_r -# define gmtime_r rpl_gmtime_r +# if @REPLACE_LOCALTIME_R@ +# undef localtime_r +# define localtime_r rpl_localtime_r +# undef gmtime_r +# define gmtime_r rpl_gmtime_r struct tm *localtime_r (time_t const *restrict __timer, struct tm *restrict __result); struct tm *gmtime_r (time_t const *restrict __timer, struct tm *restrict __result); -# endif +# endif /* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store the resulting broken-down time into TM. See . */ -# if @REPLACE_STRPTIME@ -# undef strptime -# define strptime rpl_strptime +# if @REPLACE_STRPTIME@ +# undef strptime +# define strptime rpl_strptime char *strptime (char const *restrict __buf, char const *restrict __format, struct tm *restrict __tm); -# endif +# endif /* Convert TM to a time_t value, assuming UTC. */ -# if @REPLACE_TIMEGM@ -# undef timegm -# define timegm rpl_timegm +# if @REPLACE_TIMEGM@ +# undef timegm +# define timegm rpl_timegm time_t timegm (struct tm *__tm); -# endif +# endif /* Encourage applications to avoid unsafe functions that can overrun buffers when given outlandish struct tm values. Portable applications should use strftime (or even sprintf) instead. */ -# if GNULIB_PORTCHECK -# undef asctime -# define asctime eschew_asctime -# undef asctime_r -# define asctime_r eschew_asctime_r -# undef ctime -# define ctime eschew_ctime -# undef ctime_r -# define ctime_r eschew_ctime_r -# endif - -# ifdef __cplusplus +# if GNULIB_PORTCHECK +# undef asctime +# define asctime eschew_asctime +# undef asctime_r +# define asctime_r eschew_asctime_r +# undef ctime +# define ctime eschew_ctime +# undef ctime_r +# define ctime_r eschew_ctime_r +# endif + +# ifdef __cplusplus } -# endif +# endif -# endif /* _GL_TIME_H */ -# endif /* _GL_TIME_H */ #endif