• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #define _BSD_SOURCE
2 #include <sys/time.h>
3 #include <time.h>
4 #include <errno.h>
5 #include "syscall.h"
6 
settimeofday(const struct timeval * tv,const struct timezone * tz)7 int settimeofday(const struct timeval *tv, const struct timezone *tz)
8 {
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}));
13 }
14