y2038: Add __USE_TIME_BITS64 support for struct timespec
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 17 Feb 2021 19:19:45 +0000 (16:19 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 15 Jun 2021 13:42:11 +0000 (10:42 -0300)
The __USE_TIME_BITS64 is not defined internally yet.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
time/bits/types/struct_timespec.h

index d11c69c..489e811 100644 (file)
@@ -4,15 +4,20 @@
 
 #include <bits/types.h>
 #include <bits/endian.h>
+#include <bits/types/time_t.h>
 
 /* POSIX.1b structure for a time value.  This is like a `struct timeval' but
    has nanoseconds instead of microseconds.  */
 struct timespec
 {
+#ifdef __USE_TIME_BITS64
+  __time64_t tv_sec;           /* Seconds.  */
+#else
   __time_t tv_sec;             /* Seconds.  */
+#endif
 #if __WORDSIZE == 64 \
   || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) \
-  || __TIMESIZE == 32
+  || (__TIMESIZE == 32 && !defined __USE_TIME_BITS64)
   __syscall_slong_t tv_nsec;   /* Nanoseconds.  */
 #else
 # if __BYTE_ORDER == __BIG_ENDIAN