summary refs log tree commit diff
path: root/include/struct___timeval64.h
diff options
context:
space:
mode:
authorLukasz Majewski <lukma@denx.de>2020-04-21 19:01:56 +0200
committerLukasz Majewski <lukma@denx.de>2020-05-05 19:36:25 +0200
commita308615f7c067371df8bd96cb233cd0574537863 (patch)
tree1a6ff4f4228596ad2da70f751c762f48c23cc5b7 /include/struct___timeval64.h
parent481d01fa2b07d3c6f9e6ef9ae239bc616b1ac757 (diff)
downloadglibc-a308615f7c067371df8bd96cb233cd0574537863.tar.gz
glibc-a308615f7c067371df8bd96cb233cd0574537863.tar.xz
glibc-a308615f7c067371df8bd96cb233cd0574537863.zip
y2038: include: Move struct __timeval64 definition to a separate file
The struct __timeval64's definition has been moved from ./include/time.h to
./include/struct___timeval64.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: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'include/struct___timeval64.h')
-rw-r--r--include/struct___timeval64.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/struct___timeval64.h b/include/struct___timeval64.h
new file mode 100644
index 0000000000..05cf2f26fc
--- /dev/null
+++ b/include/struct___timeval64.h
@@ -0,0 +1,17 @@
+#ifndef _STRUCT_TIMEVAL64_H
+#define _STRUCT_TIMEVAL64_H
+
+#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
+#endif /* _STRUCT_TIMEVAL64_H  */