projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix unused variable warnings in new nextafter/nexttoward code
[musl]
/
src
/
time
/
gettimeofday.c
diff --git
a/src/time/gettimeofday.c
b/src/time/gettimeofday.c
index
521b4d5
..
09afb70
100644
(file)
--- a/
src/time/gettimeofday.c
+++ b/
src/time/gettimeofday.c
@@
-1,8
+1,13
@@
+#include <time.h>
#include <sys/time.h>
#include "syscall.h"
int gettimeofday(struct timeval *tv, void *tz)
{
#include <sys/time.h>
#include "syscall.h"
int gettimeofday(struct timeval *tv, void *tz)
{
- __syscall(__NR_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;
}
return 0;
}