diff options
author | Lukasz Majewski <lukma@denx.de> | 2020-02-12 10:42:49 +0100 |
---|---|---|
committer | Lukasz Majewski <lukma@denx.de> | 2020-04-06 23:05:11 +0200 |
commit | 390b5a4727924503095327087c5d5f7a369732ef (patch) | |
tree | a9074455ae9fddb4bc5a5d363c04b0c6ef5847c5 /include/struct___timespec64.h | |
parent | b9cde4e3aa1ff338da7064daf1386b2f4a7351ba (diff) | |
download | glibc-390b5a4727924503095327087c5d5f7a369732ef.tar.gz glibc-390b5a4727924503095327087c5d5f7a369732ef.tar.xz glibc-390b5a4727924503095327087c5d5f7a369732ef.zip |
y2038: include: Move struct __timespec64 definition to a separate file
The struct __timespec64's definition has been moved from ./include/time.h to ./include/struct___timespec64.h. This change would prevent from polluting other glibc namespaces (when headers are modified to support 64 bit time on architectures with __WORDSIZE==32). Now it is possible to just include definition of this particular structure when needed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'include/struct___timespec64.h')
-rw-r--r-- | include/struct___timespec64.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/include/struct___timespec64.h b/include/struct___timespec64.h new file mode 100644 index 0000000000..9abb25c8f7 --- /dev/null +++ b/include/struct___timespec64.h @@ -0,0 +1,27 @@ +#ifndef _STRUCT_TIMESPEC64_H +#define _STRUCT_TIMESPEC64_H + +#if __TIMESIZE == 64 +# define __timespec64 timespec +#else +#include <endian.h> +/* 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 +#endif /* _STRUCT_TIMESPEC64_H */ |