diff options
Diffstat (limited to 'time/gmtime.c')
-rw-r--r-- | time/gmtime.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/time/gmtime.c b/time/gmtime.c index dc33b3e68a..d485a38c6f 100644 --- a/time/gmtime.c +++ b/time/gmtime.c @@ -18,20 +18,49 @@ #include <time.h> -/* Return the `struct tm' representation of *T in UTC, +/* Return the `struct tm' representation of T in UTC, using *TP to store the result. */ struct tm * +__gmtime64_r (const __time64_t *t, struct tm *tp) +{ + return __tz_convert (*t, 0, tp); +} + +/* Provide a 32-bit wrapper if needed */ + +#if __TIMESIZE != 64 + +struct tm * __gmtime_r (const time_t *t, struct tm *tp) { - return __tz_convert (t, 0, tp); + __time64_t t64 = *t; + return __gmtime64_r (&t64, tp); } + +#endif + +/* This always works because either __TIMESIZE != 64 and __gmtime_r exists + or __TIMESIZE == 64 and the definition of __gmtime64_r above actually + defined __gmtime_r. */ libc_hidden_def (__gmtime_r) weak_alias (__gmtime_r, gmtime_r) +/* Return the `struct tm' representation of 64-bit-time *T in UTC. */ +struct tm * +__gmtime64 (const __time64_t *t) +{ + return __tz_convert (*t, 0, &_tmbuf); +} + +/* Provide a 32-bit wrapper if needed */ + +#if __TIMESIZE != 64 -/* Return the `struct tm' representation of *T in UTC. */ struct tm * gmtime (const time_t *t) { - return __tz_convert (t, 0, &_tmbuf); + __time64_t t64 = *t; + return __gmtime64 (&t64); } + +#endif |