VxWorks, use monotonic clock, fixes #309

feature/soem_140
Andreas Karlsson 2019-06-12 14:42:26 +02:00
parent 817435066f
commit 131158dda8
1 changed files with 6 additions and 2 deletions

View File

@ -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;
}