https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

--- Comment #80 from Nicolas Boulenguez <nicolas at debian dot org> ---
John, thanks for testing!

Eric, I have removed the hardcoded 8 from comment 73, but I fail to understand
whether you also dislike the complex conditional. Anyhow, I am fine with any of
the following suggestions.

+#if !defined __GLIBC__ \
+  || __WORDSIZE == 64 \
+  || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) \
+  || (__TIMESIZE == 32 && !defined __USE_TIME64_REDIRECTS)
 #define SIZEOF_tv_nsec (sizeof (ts.tv_nsec))
+#else
+   /* https://sourceware.org/glibc/wiki/Y2038ProofnessDesign#struct_timespec
*/
+#  define SIZEOF_tv_nsec (sizeof (ts) - sizeof (ts.tv_sec))
+#endif

+#if __WORDSIZE == 64 \
+  || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) \
+  || (__TIMESIZE == 32 && !defined __USE_TIME64_REDIRECTS)
 #define SIZEOF_tv_nsec (sizeof (ts.tv_nsec))
+#else
+   /* https://sourceware.org/glibc/wiki/Y2038ProofnessDesign#struct_timespec
*/
+#  define SIZEOF_tv_nsec (sizeof (ts) - sizeof (ts.tv_sec))
+#endif

+#ifdef __GLIBC__
+   /* https://sourceware.org/glibc/wiki/Y2038ProofnessDesign#struct_timespec
*/
+#  define SIZEOF_tv_nsec (sizeof (ts) - sizeof (ts.tv_sec))
+#else
 #define SIZEOF_tv_nsec (sizeof (ts.tv_nsec))
+#endif

Reply via email to