adjust the time a bit so non-monotonic vdso vs syscall gettime does
not trigger a failure
ts2.tv_nsec += 1000000000;
ts2.tv_sec--;
}
ts2.tv_nsec += 1000000000;
ts2.tv_sec--;
}
- if (ts2.tv_sec < ts.tv_sec)
- return -1;
+ if (ts2.tv_sec < ts.tv_sec) {
+ t_error("non-monotonic SYS_clock_gettime vs clock_gettime: %llu ns\n",
+ (ts.tv_sec - ts2.tv_sec)*1000000000ULL + ts.tv_nsec - ts2.tv_nsec);
+ return 0;
+ }
return (ts2.tv_sec - ts.tv_sec)*1000000000ULL + (ts2.tv_nsec - ts.tv_nsec);
}
return (ts2.tv_sec - ts.tv_sec)*1000000000ULL + (ts2.tv_nsec - ts.tv_nsec);
}
// check if timespec is filled correctly
T(clock_gettime(CLOCK_REALTIME, &ts2));
// check if timespec is filled correctly
T(clock_gettime(CLOCK_REALTIME, &ts2));
+ // adjust because linux vdso is non-monotonic wrt the syscall..
+ ts.tv_nsec += 2;
- if (diff > 10 * 1000000000ULL)
+ if (diff > 5 * 1000000000ULL)
t_error("large diff between clock_gettime calls: %llu ns\n", diff);
return t_status;
t_error("large diff between clock_gettime calls: %llu ns\n", diff);
return t_status;