diff options
author | Albert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr> | 2017-09-08 00:42:14 +0200 |
---|---|---|
committer | Albert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr> | 2018-02-01 12:15:55 +0100 |
commit | 798bc999b029bf5dac7a5b8eb0413173f78dd348 (patch) | |
tree | e95d692be9639a6d5ec18db2302f88a2a4245fdf | |
parent | a664ccb656427bb9716d773e9af34223c70e6e95 (diff) | |
download | glibc-798bc999b029bf5dac7a5b8eb0413173f78dd348.tar.gz |
Y2038: add function __ntp_gettimex_t64
-rw-r--r-- | sysdeps/unix/sysv/linux/Versions | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ntp_gettimex.c | 31 |
2 files changed, 32 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions index 59b8964b7c..ee85fb6c64 100644 --- a/sysdeps/unix/sysv/linux/Versions +++ b/sysdeps/unix/sysv/linux/Versions @@ -171,6 +171,7 @@ libc { mlock2; pkey_alloc; pkey_free; pkey_set; pkey_get; pkey_mprotect; __ntp_gettime_t64; + __ntp_gettimex_t64; } GLIBC_PRIVATE { # functions used in other libraries diff --git a/sysdeps/unix/sysv/linux/ntp_gettimex.c b/sysdeps/unix/sysv/linux/ntp_gettimex.c index e491549765..db66e91238 100644 --- a/sysdeps/unix/sysv/linux/ntp_gettimex.c +++ b/sysdeps/unix/sysv/linux/ntp_gettimex.c @@ -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; +} |