summaryrefslogtreecommitdiffstats
path: root/usr.sbin/xntpd/lib/machines.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/xntpd/lib/machines.c')
-rw-r--r--usr.sbin/xntpd/lib/machines.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/usr.sbin/xntpd/lib/machines.c b/usr.sbin/xntpd/lib/machines.c
index 5e01694..1d1cbc9 100644
--- a/usr.sbin/xntpd/lib/machines.c
+++ b/usr.sbin/xntpd/lib/machines.c
@@ -41,3 +41,21 @@ ntp_memset(a, x, c)
*a++ = x;
}
#endif /*POSIX*/
+
+#if defined(USE_CLOCK_SETTIME)
+
+#include <time.h>
+
+int
+settimeofday(tvp)
+ struct timeval *tvp;
+{
+ struct timespec ts;
+
+ /* Convert timeval to timespec */
+ ts.tv_sec = tvp->tv_sec;
+ ts.tv_nsec = 1000 * tvp->tv_usec;
+
+ return clock_settime(CLOCK_REALTIME, &ts);
+}
+#endif /* USE_CLOCK_SETTIME */
OpenPOWER on IntegriCloud