xref: /freebsd/contrib/blocklist/port/clock_gettime.c (revision a90b9d0159070121c221b966469c3e36d912bf82)
1 #ifdef HAVE_CONFIG_H
2 #include "config.h"
3 #endif
4 
5 #include <time.h>
6 #include <sys/time.h>
7 
8 int
9 clock_gettime(int clock __unused, struct timespec *ts)
10 {
11 	struct timeval tv;
12 	if (gettimeofday(&tv, NULL) == -1)
13 		return -1;
14 	ts->tv_sec = tv.tv_sec;
15 	ts->tv_nsec = tv.tv_usec * 1000;
16 	return 0;
17 }
18