int silc_gettimeofday(struct timeval *p)
{
+#if defined(HAVE_CLOCK_GETTIME)
+ struct timespec tp;
+ if (clock_gettime(CLOCK_REALTIME, &tp))
+ return -1;
+ p->tv_sec = tp.tv_sec;
+ p->tv_usec = tp.tv_nsec / 1000;
+ return 0;
+#else
return gettimeofday(p, NULL);
+#endif /* HAVE_CLOCK_GETTIME */
}
int silc_file_set_nonblock(int fd)