[[PATCH,RFC,2] 07/63] Y2038: add function __gmtime64_r

Message ID 20180418201819.15952-8-albert.aribaud@3adev.fr
State New, archived
Headers

Commit Message

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

Patch

diff --git a/include/time.h b/include/time.h
index 81cb0fbc00..b0a1199308 100644
--- a/include/time.h
+++ b/include/time.h
@@ -71,6 +71,9 @@  extern struct tm *__gmtime_r (const time_t *__restrict __timer,
 			      struct tm *__restrict __tp);
 libc_hidden_proto (__gmtime_r)
 
+extern struct tm *__gmtime64_r (const __time64_t *__restrict __timer,
+			        struct tm *__restrict __tp);
+
 /* Compute the `struct tm' representation of T,
    offset OFFSET seconds east of UTC,
    and store year, yday, mon, mday, wday, hour, min, sec into *TP.
diff --git a/time/Versions b/time/Versions
index 511580b6d8..d226a8557f 100644
--- a/time/Versions
+++ b/time/Versions
@@ -67,7 +67,7 @@  libc {
   }
   GLIBC_2.27 {
     __difftime64;
-    __gmtime64;
+    __gmtime64; __gmtime64_r;
     __localtime64; __localtime64_r;
   }
 }
diff --git a/time/gmtime.c b/time/gmtime.c
index 4a8c0cbfd7..b66ab3f853 100644
--- a/time/gmtime.c
+++ b/time/gmtime.c
@@ -47,6 +47,14 @@  gmtime (const time_t *t)
   return __tz_convert (*t, 0, &_tmbuf);
 }
 
+/* Return the `struct tm' representation of 64-bit-time *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);
+}
+
 /* Return the `struct tm' representation of 64-bit-time *T in UTC.	*/
 struct tm *
 __gmtime64 (const __time64_t *t)