diff options
Diffstat (limited to 'include/time.h')
-rw-r--r-- | include/time.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/time.h b/include/time.h index dcf91855ad..9727786634 100644 --- a/include/time.h +++ b/include/time.h @@ -5,6 +5,7 @@ # include <bits/types/locale_t.h> # include <stdbool.h> # include <time/mktime-internal.h> +# include <endian.h> extern __typeof (strftime_l) __strftime_l; libc_hidden_proto (__strftime_l) @@ -50,6 +51,29 @@ extern void __tz_compute (__time64_t timer, struct tm *tm, int use_localtime) __THROW attribute_hidden; #if __TIMESIZE == 64 +# define __timespec64 timespec +#else +/* The glibc Y2038-proof struct __timespec64 structure for a time value. + To keep things Posix-ish, we keep the nanoseconds field a 32-bit + signed long, but since the Linux field is a 64-bit signed int, we + pad our tv_nsec with a 32-bit unnamed bit-field padding. + + As a general rule the Linux kernel is ignoring upper 32 bits of + tv_nsec field. */ +struct __timespec64 +{ + __time64_t tv_sec; /* Seconds */ +# if BYTE_ORDER == BIG_ENDIAN + __int32_t :32; /* Padding */ + __int32_t tv_nsec; /* Nanoseconds */ +# else + __int32_t tv_nsec; /* Nanoseconds */ + __int32_t :32; /* Padding */ +# endif +}; +#endif + +#if __TIMESIZE == 64 # define __ctime64 ctime #else extern char *__ctime64 (const __time64_t *__timer) __THROW; |