diff options
author | 2020-01-16 23:40:51 +0100 | |
---|---|---|
committer | 2020-02-07 17:55:08 +0100 | |
commit | 504c98717062cb9bcbd4b3e59e932d04331ddca5 (patch) | |
tree | 160f4da74fa1d00f12c80ec3134ea6fa2075e28f /include | |
parent | y2038: Define __suseconds64_t type to be used with struct __timeval64 (diff) | |
download | glibc-504c98717062cb9bcbd4b3e59e932d04331ddca5.tar.gz glibc-504c98717062cb9bcbd4b3e59e932d04331ddca5.tar.bz2 glibc-504c98717062cb9bcbd4b3e59e932d04331ddca5.zip |
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/time.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/time.h b/include/time.h index 97d17c171a..e3afd6ed03 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; |