about summary refs log tree commit diff
path: root/time
diff options
context:
space:
mode:
authorAlbert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>2018-12-18 23:13:55 +0100
committerAlbert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>2018-12-18 23:13:55 +0100
commitc4c2836ada90259e4c5632f962dfcda54ac448fa (patch)
treee1495813b347d74ac827d4844664f02d3833c657 /time
parent7755e504117cc014416a60f8498f3f15b14d6482 (diff)
downloadglibc-c4c2836ada90259e4c5632f962dfcda54ac448fa.tar.gz
glibc-c4c2836ada90259e4c5632f962dfcda54ac448fa.tar.xz
glibc-c4c2836ada90259e4c5632f962dfcda54ac448fa.zip
Y2038: add function __ctime64_r
Tested with 'make check' on x86_64-linux-gnu and i686-linux.gnu.

	* include/time.h
	(__ctime64_r): Add.
	* time/ctime_r.c
	(__ctime64_r): Add.
	[__TIMESIZE != 64] (__ctime_r): Turn into a wrapper.
Diffstat (limited to 'time')
-rw-r--r--time/ctime_r.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/time/ctime_r.c b/time/ctime_r.c
index c111146d76..38be6789f1 100644
--- a/time/ctime_r.c
+++ b/time/ctime_r.c
@@ -22,8 +22,23 @@
 /* Return a string as returned by asctime which is the representation
    of *T in that form.  Reentrant version.  */
 char *
-ctime_r (const time_t *t, char *buf)
+__ctime64_r (const __time64_t *t, char *buf)
 {
   struct tm tm;
-  return __asctime_r (__localtime_r (t, &tm), buf);
+  return __asctime_r (__localtime64_r (t, &tm), buf);
+}
+
+/* Provide a 32-bit variant if needed.  */
+
+#if __TIMESIZE != 64
+
+libc_hidden_def (__ctime64_r)
+
+char *
+ctime_r (const time_t *t, char *buf)
+{
+  __time64_t t64 = *t;
+  return __ctime64_r (&t64, buf);
 }
+
+#endif