public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] y2038: Introduce struct __timeval64 - new internal glibc type
@ 2020-02-07 16:56 Lukasz Majewski
  0 siblings, 0 replies; only message in thread
From: Lukasz Majewski @ 2020-02-07 16:56 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=504c98717062cb9bcbd4b3e59e932d04331ddca5

commit 504c98717062cb9bcbd4b3e59e932d04331ddca5
Author: Lukasz Majewski <lukma@denx.de>
Date:   Thu Jan 16 23:40:51 2020 +0100

    y2038: Introduce struct __timeval64 - new internal glibc type
    
    This type is a glibc's "internal" type similar to struct timeval but
    whose tv_sec field is a __time64_t rather than a time_t, which makes it
    Y2038-proof. This struct is NOT supposed to be passed to the kernel -
    instead it shall be converted to struct __timespec64 and clock_[sg]ettime
    syscalls shall be used (which are now Y2038 safe).
    
    Build tests:
    ./src/scripts/build-many-glibcs.py glibcs
    
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

Diff:
---
 include/time.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/include/time.h b/include/time.h
index 97d17c1..e3afd6e 100644
--- a/include/time.h
+++ b/include/time.h
@@ -94,6 +94,20 @@ struct __itimerspec64
 #endif
 
 #if __TIMESIZE == 64
+# define __timeval64 timeval
+#else
+/* The glibc Y2038-proof struct __timeval64 structure for a time value.
+   This structure is NOT supposed to be passed to the Linux kernel.
+   Instead, it shall be converted to struct __timespec64 and time shall
+   be [sg]et via clock_[sg]ettime (which are now Y2038 safe).  */
+struct __timeval64
+{
+  __time64_t tv_sec;         /* Seconds */
+  __suseconds64_t tv_usec;       /* Microseconds */
+};
+#endif
+
+#if __TIMESIZE == 64
 # define __ctime64 ctime
 #else
 extern char *__ctime64 (const __time64_t *__timer) __THROW;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-02-07 16:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-07 16:56 [glibc] y2038: Introduce struct __timeval64 - new internal glibc type Lukasz Majewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).