diff options
author | Albert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr> | 2018-06-18 21:14:43 +0200 |
---|---|---|
committer | Albert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr> | 2018-10-10 00:21:43 +0200 |
commit | 7d82403ed8b6361e362ee8fbf4c3b316e26268dc (patch) | |
tree | 54a0d6c8fcf4d75f7fb4303a1fdd948cc3c8b34c /include/time.h | |
parent | 6ccd9dd89364bccd3f9774be68232908bdbda8b9 (diff) | |
download | glibc-aaribaud/make-check.tar.gz |
Y2038: make __tz_convert compatible with 64-bit-timeaaribaud/make-check
Now that __time_64_t exists, we can switch internal function
__tz_convert from 32-bit to 64-bit time. This involves switching
some other internal functions and turning some implementations
which use these into wrappers between public 32-bit and internal
64-bit time.
* __tz_compute: Pass timer as a __time64_t rather than time_t.
* __offtime: Pass __timer as a __time64_t value rather than
a const time_t pointer.
* __tz_convert: Likewise.
* localtime: provide a 64-bit time version and make the 32-bit
time version a wrapper of it.
* localtime_r: Likewise.
* ctime: Likewise.
* ctime_r: Likewise.
* gmtime: Likewise.
* gmtime_r: Likewise.
Diffstat (limited to 'include/time.h')
-rw-r--r-- | include/time.h | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/include/time.h b/include/time.h index e99711a556..16c77e8825 100644 --- a/include/time.h +++ b/include/time.h @@ -46,7 +46,7 @@ extern void __tzfile_default (const char *std, const char *dst, long int stdoff, long int dstoff) attribute_hidden; extern void __tzset_parse_tz (const char *tz) attribute_hidden; -extern void __tz_compute (time_t timer, struct tm *tm, int use_localtime) +extern void __tz_compute (__time64_t timer, struct tm *tm, int use_localtime) __THROW attribute_hidden; /* Subroutine of `mktime'. Return the `time_t' representation of TP and @@ -56,18 +56,51 @@ extern time_t __mktime_internal (struct tm *__tp, struct tm *(*__func) (const time_t *, struct tm *), long int *__offset) attribute_hidden; + +/* nis/nis_print.c needs ctime, so even if ctime is not declared here, + we define __ctime64 as ctime so that nis/nis_print.c can get linked + against a function called ctime. */ +#if __TIMESIZE == 64 +# define __ctime64 ctime +#endif + +#if __TIMESIZE == 64 +# define __ctime64_r ctime_r +#endif + +#if __TIMESIZE == 64 +# define __localtime64 localtime +#else +extern struct tm *__localtime64 (const __time64_t *__timer); +#endif + extern struct tm *__localtime_r (const time_t *__timer, struct tm *__tp) attribute_hidden; +#if __TIMESIZE == 64 +# define __localtime64_r __localtime_r +#else +extern struct tm *__localtime64_r (const __time64_t *__timer, + struct tm *__tp) attribute_hidden; +#endif + extern struct tm *__gmtime_r (const time_t *__restrict __timer, struct tm *__restrict __tp); libc_hidden_proto (__gmtime_r) -/* Compute the `struct tm' representation of *T, +#if __TIMESIZE == 64 +# define __gmtime64 gmtime +# define __gmtime64_r __gmtime_r +#else +extern struct tm *__gmtime64_r (const __time64_t *__restrict __timer, + struct tm *__restrict __tp); +#endif + +/* Compute the `struct tm' representation of T, offset OFFSET seconds east of UTC, and store year, yday, mon, mday, wday, hour, min, sec into *TP. Return nonzero if successful. */ -extern int __offtime (const time_t *__timer, +extern int __offtime (__time64_t __timer, long int __offset, struct tm *__tp) attribute_hidden; @@ -76,8 +109,8 @@ extern char *__asctime_r (const struct tm *__tp, char *__buf) extern void __tzset (void) attribute_hidden; /* Prototype for the internal function to get information based on TZ. */ -extern struct tm *__tz_convert (const time_t *timer, int use_localtime, - struct tm *tp) attribute_hidden; +extern struct tm *__tz_convert (__time64_t timer, int use_localtime, + struct tm *tp) attribute_hidden; extern int __nanosleep (const struct timespec *__requested_time, struct timespec *__remaining); |