@@ -37,3 +37,29 @@ __gettimeofday (struct timeval *tv, struct timezone *tz)
libc_hidden_def (__gettimeofday)
weak_alias (__gettimeofday, gettimeofday)
libc_hidden_weak (gettimeofday)
+
+/* 64-bit time version */
+
+extern int __y2038_linux_support;
+
+int
+__gettimeofday_t64 (struct __timeval64 *tv, struct timezone *tz)
+{
+ struct timeval tv32;
+ int result;
+
+ if (__y2038_linux_support)
+ {
+ /* TODO: implement using 64-bit time syscall */
+ }
+
+ result = INLINE_VSYSCALL (gettimeofday, 2, &tv32, tz);
+
+ if (result == 0)
+ {
+ tv->tv_sec = tv32.tv_sec;
+ tv->tv_usec = tv32.tv_usec;
+ }
+
+ return result;
+}
@@ -73,5 +73,6 @@ libc {
__timespec_get64;
__time_t64;
__stime_t64;
+ __gettimeofday_t64;
}
}
@@ -32,3 +32,13 @@ weak_alias (__gettimeofday, gettimeofday)
libc_hidden_weak (gettimeofday)
stub_warning (gettimeofday)
+
+/* 64-bit time version */
+
+int
+__gettimeofday_t64 (struct timeval *tv, struct timezone *tz)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (__gettimeofday_t64)
Implementing a 64-bit settimeofday requires adding a new file to build under time/ and we cannot name that new file 'settimeofday.c' or it will break the 32-bit settimeofday symbol, so we call it 'settimeofday64.c'. Signed-off-by: Albert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr> --- sysdeps/unix/sysv/linux/gettimeofday.c | 26 ++++++++++++++++++++++++++ time/Versions | 1 + time/gettimeofday.c | 10 ++++++++++ 3 files changed, 37 insertions(+)