X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Ftime%2Fgettimeofday.c;h=09afb70bf8ef4f8ba7ccb12fe381319023f105f0;hb=4f346b08b33c9265c36fe8a14f5f908b1a9f296a;hp=2b8a287d36bd25fe5949ac23a09fbfb8526ec441;hpb=0b44a0315b47dd8eced9f3b7f31580cf14bbfc01;p=musl diff --git a/src/time/gettimeofday.c b/src/time/gettimeofday.c index 2b8a287d..09afb70b 100644 --- a/src/time/gettimeofday.c +++ b/src/time/gettimeofday.c @@ -1,9 +1,13 @@ -#define SYSCALL_RETURN_ERRNO +#include #include #include "syscall.h" int gettimeofday(struct timeval *tv, void *tz) { - syscall2(__NR_gettimeofday, (long)tv, 0); + struct timespec ts; + if (!tv) return 0; + clock_gettime(CLOCK_REALTIME, &ts); + tv->tv_sec = ts.tv_sec; + tv->tv_usec = (int)ts.tv_nsec / 1000; return 0; }