Skip to content

Commit

Permalink
VxWorks, use monotonic clock, fixes OpenEtherCATsociety#309
Browse files Browse the repository at this point in the history
Andreas Karlsson committed Jun 12, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 8174350 commit 131158d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions osal/vxworks/osal.c
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit 131158d

Please sign in to comment.