X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Ftime%2Fgettimeofday.c;h=691f8e9043b2c61bf8b49faf03cf902a81b1c964;hb=3bb6bd85808ace7b588d1c523bb7badfd9e72650;hp=2436e490410707a69d20ea820b5f4294cc1420ea;hpb=c2cd25bff89c3581780e7eb267262cb8c4da0d38;p=musl diff --git a/src/time/gettimeofday.c b/src/time/gettimeofday.c index 2436e490..691f8e90 100644 --- a/src/time/gettimeofday.c +++ b/src/time/gettimeofday.c @@ -1,8 +1,13 @@ +#include #include #include "syscall.h" -int gettimeofday(struct timeval *tv, void *tz) +int gettimeofday(struct timeval *restrict tv, void *restrict tz) { - __syscall(SYS_gettimeofday, 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; }