summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>2017-09-08 00:42:13 +0200
committerAlbert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>2018-04-18 21:28:44 +0200
commit713734113f07681810c8e4c75b8aee78bc3c9771 (patch)
tree9aed97cc7217d2f5f60528ee77d1d5113b58c5e1
parent9957823c9efbafb1e567a064b024e8b47901bb9a (diff)
downloadglibc-713734113f07681810c8e4c75b8aee78bc3c9771.tar.gz
Y2038: add function __ntp_gettime64
-rw-r--r--sysdeps/unix/sysv/linux/Versions1
-rw-r--r--sysdeps/unix/sysv/linux/ntp_gettime.c25
2 files changed, 26 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions
index 336c13b57d..07a36e87db 100644
--- a/sysdeps/unix/sysv/linux/Versions
+++ b/sysdeps/unix/sysv/linux/Versions
@@ -170,6 +170,7 @@ libc {
memfd_create;
mlock2;
pkey_alloc; pkey_free; pkey_set; pkey_get; pkey_mprotect;
+ __ntp_gettime64;
}
GLIBC_PRIVATE {
# functions used in other libraries
diff --git a/sysdeps/unix/sysv/linux/ntp_gettime.c b/sysdeps/unix/sysv/linux/ntp_gettime.c
index 18650da94c..7e1d70fb3b 100644
--- a/sysdeps/unix/sysv/linux/ntp_gettime.c
+++ b/sysdeps/unix/sysv/linux/ntp_gettime.c
@@ -18,6 +18,7 @@
#define ntp_gettime ntp_gettime_redirect
#include <sys/timex.h>
+#include <include/time.h>
#undef ntp_gettime
@@ -39,3 +40,27 @@ ntp_gettime (struct ntptimeval *ntv)
ntv->esterror = tntx.esterror;
return result;
}
+
+/* The 64-bit-time version */
+
+extern int __y2038_linux_support;
+
+int
+__ntp_gettime64 (struct __ntptimeval64 *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->esterror = tntx.esterror;
+ return result;
+}