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

Albert ARIBAUD (3ADEV) albert.aribaud@3adev.fr
Wed Apr 18 20:19:00 GMT 2018


---
 time/Versions  | 2 +-
 time/ctime_r.c | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

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);
+}
-- 
2.14.1



More information about the Libc-alpha mailing list