Skip to content

Commit

Permalink
Fix timespec overflow in red_test
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkalmuk committed Apr 2, 2021
1 parent 61ef8e3 commit 52cb5fd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/linux/red_test/red_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ OSAL_THREAD_FUNC_RT ecatthread(void *ptr)
clock_gettime(CLOCK_MONOTONIC, &ts);
ht = (ts.tv_nsec / 1000000) + 1; /* round to nearest ms */
ts.tv_nsec = ht * 1000000;
if (ts.tv_nsec >= NSEC_PER_SEC) {
ts.tv_sec++;
ts.tv_nsec -= NSEC_PER_SEC;
}
cycletime = *(int*)ptr * 1000; /* cycletime in ns */
toff = 0;
dorun = 0;
Expand Down

0 comments on commit 52cb5fd

Please sign in to comment.