-#define T(f) ((f) && (t_error(#f " failed: %s\n", strerror(errno)), 0))
-
-static unsigned long long tsdiff(struct timespec ts2, struct timespec ts)
-{
- if (ts2.tv_nsec < ts.tv_nsec) {
- ts2.tv_nsec += 1000000000;
- ts2.tv_sec--;
- }
- 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);
-}