Fix timespec overflow in red_test

This commit is contained in:
Alex Kalmuk 2021-04-02 23:13:28 +03:00
parent 61ef8e3198
commit 52cb5fd5da
1 changed files with 4 additions and 0 deletions

View File

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