fix setgroups behavior in multithreaded process
[musl.git] / src / linux / settimeofday.c
blob860fb5de97b006c2d0c2c1e12a1cd6fd3f3a9a1b
1 #define _BSD_SOURCE
2 #include <sys/time.h>
3 #include <time.h>
4 #include <errno.h>
5 #include "syscall.h"
7 int settimeofday(const struct timeval *tv, const struct timezone *tz)
9 if (!tv) return 0;
10 if (tv->tv_usec >= 1000000ULL) return __syscall_ret(-EINVAL);
11 return clock_settime(CLOCK_REALTIME, &((struct timespec){
12 .tv_sec = tv->tv_sec, .tv_nsec = tv->tv_usec * 1000}));