about summary refs log tree commit diff
path: root/time/localtime.c
diff options
context:
space:
mode:
authorAlbert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>2018-12-18 23:11:08 +0100
committerAlbert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>2018-12-18 23:11:08 +0100
commit64c2277d2eb14b6b485a16b799d900505e2cbe71 (patch)
treeccf33d4c07dff1a2125da43bf49ab4626f2182e9 /time/localtime.c
parent64dd7a16305441a7d6ed752c192c68b6c2a54ca5 (diff)
downloadglibc-64c2277d2eb14b6b485a16b799d900505e2cbe71.tar.gz
glibc-64c2277d2eb14b6b485a16b799d900505e2cbe71.tar.xz
glibc-64c2277d2eb14b6b485a16b799d900505e2cbe71.zip
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.
Diffstat (limited to 'time/localtime.c')
-rw-r--r--time/localtime.c17
1 files changed, 16 insertions, 1 deletions
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)