#ifndef TIME_H_ #define TIME_H_ #include #define TIMESPEC_TO_DOUBLE(ts) ((double)(ts).tv_sec + ((double)(ts).tv_nsec / TIMESPEC_HZ)) enum { TIMESPEC_HZ = 1000000000 }; const struct timespec one_second = {1, 0}, zero_seconds = {0, 0}; struct timespec timespec_add(struct timespec a, struct timespec b); struct timespec timespec_sub(struct timespec a, struct timespec b); int timespec_cmp(struct timespec a, struct timespec b); struct timespec timespec_min(struct timespec a, struct timespec b); struct timespec timespec_max(struct timespec a, struct timespec b); #endif /* TIME_H_ */