diff mbox

[[PATCH,RFC,2] 05/63] Y2038: add function __localtime64_r

Message ID 20180418201819.15952-6-albert.aribaud@3adev.fr
State New
Headers show

Commit Message

Albert ARIBAUD April 18, 2018, 8:17 p.m. UTC
---
 include/time.h   | 3 +++
 time/Versions    | 2 +-
 time/localtime.c | 8 ++++++++
 3 files changed, 12 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/include/time.h b/include/time.h
index 1d8f76f0c3..81cb0fbc00 100644
--- a/include/time.h
+++ b/include/time.h
@@ -64,6 +64,9 @@  extern time_t __mktime_internal (struct tm *__tp,
 extern struct tm *__localtime_r (const time_t *__timer,
 				 struct tm *__tp) attribute_hidden;
 
+extern struct tm *__localtime64_r (const __time64_t *__timer,
+				   struct tm *__tp) attribute_hidden;
+
 extern struct tm *__gmtime_r (const time_t *__restrict __timer,
 			      struct tm *__restrict __tp);
 libc_hidden_proto (__gmtime_r)
diff --git a/time/Versions b/time/Versions
index 48d545b8c8..723a03cd13 100644
--- a/time/Versions
+++ b/time/Versions
@@ -67,6 +67,6 @@  libc {
   }
   GLIBC_2.27 {
     __difftime64;
-    __localtime64;
+    __localtime64; __localtime64_r;
   }
 }
diff --git a/time/localtime.c b/time/localtime.c
index 74f7ad6807..0a9a826a6a 100644
--- a/time/localtime.c
+++ b/time/localtime.c
@@ -53,6 +53,14 @@  libc_hidden_def (localtime)
 
 /* 64-bit-time versions */
 
+/* Return the `struct tm' representation of *T in local time,
+   using *TP to store the result.  */
+struct tm *
+__localtime64_r (const __time64_t *t, struct tm *tp)
+{
+  return __tz_convert (*t, 1, tp);
+}
+
 /* Return the `struct tm' representation of *T in local time.  */
 struct tm *
 __localtime64 (const __time64_t *t)