[[PATCH,RFC,2] 09/63] Y2038: add function __ctime64_r

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

Commit Message

Albert ARIBAUD April 18, 2018, 8:17 p.m. UTC
  ---
 time/Versions  | 2 +-
 time/ctime_r.c | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)
  

Patch

diff --git a/time/Versions b/time/Versions
index b625c55c82..0ad2749f2c 100644
--- a/time/Versions
+++ b/time/Versions
@@ -67,7 +67,7 @@  libc {
   }
   GLIBC_2.27 {
     __difftime64;
-    __ctime64;
+    __ctime64; __ctime64_r;
     __gmtime64; __gmtime64_r;
     __localtime64; __localtime64_r;
   }
diff --git a/time/ctime_r.c b/time/ctime_r.c
index c111146d76..742a967fdd 100644
--- a/time/ctime_r.c
+++ b/time/ctime_r.c
@@ -27,3 +27,12 @@  ctime_r (const time_t *t, char *buf)
   struct tm tm;
   return __asctime_r (__localtime_r (t, &tm), buf);
 }
+
+/* Return a string as returned by asctime which is the representation
+   of *T in that form.  Reentrant Y2038-proof version.  */
+char *
+__ctime64_r (const __time64_t *t, char *buf)
+{
+  struct tm tm;
+  return __asctime_r (__localtime64_r (t, &tm), buf);
+}