blob: 691f8e9043b2c61bf8b49faf03cf902a81b1c964 [file] [log] [blame]
Rich Felkere3eb4932011-07-23 23:45:33 -04001#include <time.h>
Rich Felker0b44a032011-02-12 00:22:29 -05002#include <sys/time.h>
3#include "syscall.h"
4
Rich Felker400c5e52012-09-06 22:44:55 -04005int gettimeofday(struct timeval *restrict tv, void *restrict tz)
Rich Felker0b44a032011-02-12 00:22:29 -05006{
Rich Felkere3eb4932011-07-23 23:45:33 -04007 struct timespec ts;
8 if (!tv) return 0;
9 clock_gettime(CLOCK_REALTIME, &ts);
10 tv->tv_sec = ts.tv_sec;
11 tv->tv_usec = (int)ts.tv_nsec / 1000;
Rich Felker0b44a032011-02-12 00:22:29 -050012 return 0;
13}