summaryrefslogtreecommitdiff
path: root/time/ctime.c
diff options
context:
space:
mode:
authorAlbert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>2018-04-11 21:32:34 +0200
committerAlbert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>2018-06-15 20:05:16 +0200
commit66f277a3a40f369ca8e583d410f5f7771da5aa61 (patch)
tree4b1b7e57f3fdd33bd8d75fa97a160ddecb5088db /time/ctime.c
parent38a873073548a9a52136067df65cf47103e3342b (diff)
downloadglibc-aaribaud/tmp.tar.gz
Y2038: make __tz_convert compatible with 64-bit-timeaaribaud/tmp
This implies that its callers be 64-bit-time compatible too. It is done by creating 64-bit-time versions of these and turning their original 32-bit-time versions into wrappers (at a slight execution time cost). The callers affected are: * localtime * localtime_r * ctime * ctime_r * gmtime * gmtime_r Note that in time/tzfile.c we do not need to check for time_t overflows anymore as introduced by commit fc79706a323 since we now use internal_time_t.
Diffstat (limited to 'time/ctime.c')
-rw-r--r--time/ctime.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/time/ctime.c b/time/ctime.c
index 1222614f29..fe6eb45cae 100644
--- a/time/ctime.c
+++ b/time/ctime.c
@@ -16,13 +16,27 @@
<http://www.gnu.org/licenses/>. */
#include <time.h>
+#include <errno.h>
/* Return a string as returned by asctime which
is the representation of *T in that form. */
char *
-ctime (const time_t *t)
+__ctime64 (const __time64_t *t)
{
/* The C Standard says ctime (t) is equivalent to asctime (localtime (t)).
In particular, ctime and asctime must yield the same pointer. */
- return asctime (localtime (t));
+ return asctime (__localtime64 (t));
}
+
+/* Provide a 32-bit wrapper if needed */
+
+#if __TIMESIZE != 64
+
+char *
+ctime (const time_t *t)
+{
+ __time64_t t64 = *t;
+ return __ctime64 (&t64);
+}
+
+#endif