From 131158dda8338d48718494f0aea863392df820a3 Mon Sep 17 00:00:00 2001 From: Andreas Karlsson Date: Wed, 12 Jun 2019 14:42:26 +0200 Subject: [PATCH] VxWorks, use monotonic clock, fixes #309 --- osal/vxworks/osal.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osal/vxworks/osal.c b/osal/vxworks/osal.c index a9f7f84..cfb0d02 100644 --- a/osal/vxworks/osal.c +++ b/osal/vxworks/osal.c @@ -72,10 +72,14 @@ int osal_usleep (uint32 usec) int osal_gettimeofday(struct timeval *tv, struct timezone *tz) { + struct timespec ts; int return_value; + (void)tz; /* Not used */ - return_value = gettimeofday(tv, tz); - + /* Use clock_gettime CLOCK_MONOTONIC to a avoid NTP time adjustments */ + return_value = clock_gettime(CLOCK_MONOTONIC, &ts); + tv->tv_sec = ts.tv_sec; + tv->tv_usec = ts.tv_nsec / 1000; return return_value; }