@@ -133,6 +133,14 @@ libc_hidden_proto (__clock_settime64)
#endif
#if __TIMESIZE == 64
+# define __clock_gettime64 __clock_gettime
+#else
+extern int __clock_gettime64 (clockid_t clock_id,
+ struct __timespec64 *tp);
+libc_hidden_proto (__clock_gettime64);
+#endif
+
+#if __TIMESIZE == 64
# define __clock_getres64 __clock_getres
#else
extern int __clock_getres64 (clockid_t clock_id,
@@ -28,9 +28,40 @@
/* Get current value of CLOCK and store it in TP. */
int
-__clock_gettime (clockid_t clock_id, struct timespec *tp)
+__clock_gettime64 (clockid_t clock_id, struct __timespec64 *tp)
{
+#if defined (__TIMESIZE) && __TIMESIZE != 64
+# if defined __NR_clock_gettime64
+ return INLINE_SYSCALL_CALL (clock_gettime64, clock_id, tp);
+# else
+ struct timespec ts32;
+ int retval = INLINE_VSYSCALL (clock_gettime, 2, clock_id, &ts32);
+ if (! retval)
+ valid_timespec_to_timespec64(&ts32, tp);
+
+ return retval;
+# endif
+#else
return INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp);
+#endif
}
weak_alias (__clock_gettime, clock_gettime)
libc_hidden_def (__clock_gettime)
+
+#if __TIMESIZE != 64
+int
+__clock_gettime (clockid_t clock_id, struct timespec *tp)
+{
+ struct __timespec64 ts64;
+ int retval;
+
+ retval = __clock_gettime64 (clock_id, &ts64);
+ if (! retval && ! timespec64_to_timespec (&ts64, tp))
+ {
+ __set_errno (EOVERFLOW);
+ return -1;
+ }
+
+ return retval;
+}
+#endif