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