From 64c2277d2eb14b6b485a16b799d900505e2cbe71 Mon Sep 17 00:00:00 2001 From: "Albert ARIBAUD (3ADEV)" Date: Tue, 18 Dec 2018 23:11:08 +0100 Subject: Y2038: add function __localtime64_r Tested with 'make check' on x86_64-linux-gnu and i686-linux.gnu. * include/time.h (__localtime64_r): Add. * time/localtime.c (__localtime64_r): Add. [__TIMESIZE != 64] (__localtime_r): Turn into a wrapper. --- time/localtime.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'time/localtime.c') diff --git a/time/localtime.c b/time/localtime.c index 96879d4ec0..9367c7082b 100644 --- a/time/localtime.c +++ b/time/localtime.c @@ -25,10 +25,25 @@ struct tm _tmbuf; /* Return the `struct tm' representation of *T in local time, using *TP to store the result. */ struct tm * -__localtime_r (const time_t *t, struct tm *tp) +__localtime64_r (const __time64_t *t, struct tm *tp) { return __tz_convert (*t, 1, tp); } + +/* Provide a 32-bit variant if needed. */ + +#if __TIMESIZE != 64 + +struct tm * +__localtime_r (const time_t *t, struct tm *tp) +{ + __time64_t t64 = *t; + return __localtime64_r (&t64, tp); +} +libc_hidden_def (__localtime64_r) + +#endif + weak_alias (__localtime_r, localtime_r) -- cgit 1.4.1