summaryrefslogtreecommitdiff
path: root/src/time/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/time/time.c')
-rw-r--r--src/time/time.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/time/time.c b/src/time/time.c
index 05e075b9..22754850 100644
--- a/src/time/time.c
+++ b/src/time/time.c
@@ -2,10 +2,12 @@
#include <sys/time.h>
#include "syscall.h"
+int __clock_gettime(clockid_t, struct timespec *);
+
time_t time(time_t *t)
{
- struct timeval tv;
- __syscall(SYS_gettimeofday, &tv, 0);
- if (t) *t = tv.tv_sec;
- return tv.tv_sec;
+ struct timespec ts;
+ __clock_gettime(CLOCK_REALTIME, &ts);
+ if (t) *t = ts.tv_sec;
+ return ts.tv_sec;
}