@@ -140,6 +140,14 @@ extern int __clock_settime64 (clockid_t clock_id,
libc_hidden_proto (__clock_settime64)
#endif
+#if __TIMESIZE == 64
+# define __clock_getres64 __clock_getres
+#else
+extern int __clock_getres64 (clockid_t clock_id,
+ struct __timespec64 *tp);
+libc_hidden_proto (__clock_getres64);
+#endif
+
/* Compute the `struct tm' representation of T,
offset OFFSET seconds east of UTC,
and store year, yday, mon, mday, wday, hour, min, sec into *TP.
@@ -28,8 +28,45 @@
/* Get resolution of clock. */
int
-__clock_getres (clockid_t clock_id, struct timespec *res)
+__clock_getres64 (clockid_t clock_id, struct __timespec64 *res)
{
+#if defined (__TIMESIZE) && __TIMESIZE != 64
+# ifdef __NR_clock_getres_time64
+ int ret = INLINE_VSYSCALL (clock_getres_time64, 2, clock_id, res);
+# ifdef __ASSUME_64BIT_TIME
+ return ret;
+# else
+ if (ret == 0 || errno != ENOSYS)
+ /* Preserve non-error/non-ENOSYS return values. */
+ return ret;
+# endif
+# endif
+ struct timespec ts32;
+ int retval = INLINE_VSYSCALL (clock_getres, 2, clock_id, &ts32);
+ if (! retval)
+ valid_timespec_to_timespec64(&ts32, res);
+
+ return retval;
+#else
return INLINE_VSYSCALL (clock_getres, 2, clock_id, res);
+#endif
}
weak_alias (__clock_getres, clock_getres)
+
+#if __TIMESIZE != 64
+int
+__clock_getres (clockid_t clock_id, struct timespec *res)
+{
+ struct __timespec64 ts64;
+ int retval;
+
+ retval = __clock_getres64 (clock_id, &ts64);
+ if (! retval && res && ! timespec64_to_timespec (&ts64, res))
+ {
+ __set_errno (EOVERFLOW);
+ return -1;
+ }
+
+ return retval;
+}
+#endif