diff mbox

[[PATCH,RFC,2] 04/63] Y2038: add function __localtime64

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

Commit Message

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

Patch

diff --git a/include/time.h b/include/time.h
index 6ffa9b2efc..1d8f76f0c3 100644
--- a/include/time.h
+++ b/include/time.h
@@ -9,6 +9,8 @@  extern __typeof (strftime_l) __strftime_l;
 libc_hidden_proto (__strftime_l)
 extern __typeof (strptime_l) __strptime_l;
 
+extern struct tm *__localtime64 (const __time64_t *__timer);
+
 libc_hidden_proto (time)
 libc_hidden_proto (asctime)
 libc_hidden_proto (mktime)
@@ -17,6 +19,8 @@  libc_hidden_proto (localtime)
 libc_hidden_proto (strftime)
 libc_hidden_proto (strptime)
 
+libc_hidden_proto (__localtime64)
+
 extern __typeof (clock_getres) __clock_getres;
 extern __typeof (clock_gettime) __clock_gettime;
 libc_hidden_proto (__clock_gettime)
diff --git a/time/Versions b/time/Versions
index 57314b98c8..48d545b8c8 100644
--- a/time/Versions
+++ b/time/Versions
@@ -67,5 +67,6 @@  libc {
   }
   GLIBC_2.27 {
     __difftime64;
+    __localtime64;
   }
 }
diff --git a/time/localtime.c b/time/localtime.c
index 362fdb3c21..74f7ad6807 100644
--- a/time/localtime.c
+++ b/time/localtime.c
@@ -50,3 +50,12 @@  localtime (const time_t *t)
   return __tz_convert (*t, 1, &_tmbuf);
 }
 libc_hidden_def (localtime)
+
+/* 64-bit-time versions */
+
+/* Return the `struct tm' representation of *T in local time.  */
+struct tm *
+__localtime64 (const __time64_t *t)
+{
+  return __tz_convert (*t, 1, &_tmbuf);
+}