about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/time/timer_gettime.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/time/timer_gettime.c b/src/time/timer_gettime.c
index ed6d8d65..21c9d32c 100644
--- a/src/time/timer_gettime.c
+++ b/src/time/timer_gettime.c
@@ -8,5 +8,21 @@ int timer_gettime(timer_t t, struct itimerspec *val)
 		pthread_t td = (void *)((uintptr_t)t << 1);
 		t = (void *)(uintptr_t)(td->timer_id & INT_MAX);
 	}
+#ifdef SYS_timer_gettime64
+	int r = -ENOSYS;
+	if (sizeof(time_t) > 4)
+		r = __syscall(SYS_timer_gettime64, t, val);
+	if (SYS_timer_gettime == SYS_timer_gettime64 || r!=-ENOSYS)
+		return __syscall_ret(r);
+	long val32[4];
+	r = __syscall(SYS_timer_gettime, t, val32);
+	if (!r) {
+		val->it_interval.tv_sec = val32[0];
+		val->it_interval.tv_nsec = val32[1];
+		val->it_value.tv_sec = val32[2];
+		val->it_value.tv_nsec = val32[3];
+	}
+	return __syscall_ret(r);
+#endif
 	return syscall(SYS_timer_gettime, t, val);
 }