[RFC,47/52] Y2038: add function __ntp_gettimex_t64
Commit Message
Signed-off-by: Albert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>
---
sysdeps/unix/sysv/linux/Versions | 1 +
sysdeps/unix/sysv/linux/ntp_gettimex.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+)
@@ -179,5 +179,6 @@ libc {
GLIBC_Y2038 {
__msgctl_t64;
__ntp_gettime_t64;
+ __ntp_gettimex_t64;
}
}
@@ -16,6 +16,7 @@
<http://www.gnu.org/licenses/>. */
#include <sys/timex.h>
+#include <include/time.h>
#ifndef MOD_OFFSET
# define modes mode
@@ -40,3 +41,33 @@ ntp_gettimex (struct ntptimeval *ntv)
ntv->__glibc_reserved4 = 0;
return result;
}
+
+/* The 64-bit-time version */
+
+extern int __y2038_linux_support;
+
+int
+__ntp_gettimex_t64 (struct __ntptimeval_t64 *ntv)
+{
+ struct timex tntx;
+ int result;
+
+ if (__y2038_linux_support)
+ {
+ // TODO: use 64-bit syscall if possible
+ }
+
+ tntx.modes = 0;
+ result = __adjtimex (&tntx);
+ ntv->time.tv_sec = tntx.time.tv_sec;
+ ntv->time.tv_usec = tntx.time.tv_usec;
+ ntv->maxerror = tntx.maxerror;
+ ntv->maxerror = tntx.maxerror;
+ ntv->esterror = tntx.esterror;
+ ntv->tai = tntx.tai;
+ ntv->__glibc_reserved1 = 0;
+ ntv->__glibc_reserved2 = 0;
+ ntv->__glibc_reserved3 = 0;
+ ntv->__glibc_reserved4 = 0;
+ return result;
+}