This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 7/8] Y2038: add function __ctime64_r


	* include/time.h
	(__ctime64_r): Add.
	* time/ctime_r.c
	(__ctime64_r): Add.
	(__ctime_r): Compile only if __TIMERSIZE != 64.
---
 include/time.h |  4 ++++
 time/ctime_r.c | 13 +++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/include/time.h b/include/time.h
index 0247146211..c26cfb40f6 100644
--- a/include/time.h
+++ b/include/time.h
@@ -64,6 +64,10 @@ extern time_t __mktime_internal (struct tm *__tp,
 # define __ctime64 ctime
 #endif
 
+#if __TIMESIZE == 64
+# define __ctime64_r ctime_r
+#endif
+
 #if __TIMESIZE == 64
 # define __localtime64 localtime
 #else
diff --git a/time/ctime_r.c b/time/ctime_r.c
index c111146d76..be4e62c86d 100644
--- a/time/ctime_r.c
+++ b/time/ctime_r.c
@@ -21,9 +21,22 @@
 
 /* Return a string as returned by asctime which is the representation
    of *T in that form.  Reentrant version.  */
+char *
+__ctime64_r (const __time64_t *t, char *buf)
+{
+  struct tm tm;
+  return __asctime_r (__localtime64_r (t, &tm), buf);
+}
+
+/* Provide a 32-bit variant if needed */
+
+#if __TIMESIZE != 64
+
 char *
 ctime_r (const time_t *t, char *buf)
 {
   struct tm tm;
   return __asctime_r (__localtime_r (t, &tm), buf);
 }
+
+#endif
-- 
2.17.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]