add timerspecsub

This commit is contained in:
Brent Cook 2017-12-12 03:31:35 -06:00
parent 6d0192ff17
commit 7b6953e9a9

View File

@ -21,3 +21,15 @@ struct tm *__gmtime_r(const time_t * t, struct tm * tm);
#ifndef HAVE_TIMEGM
time_t timegm(struct tm *tm);
#endif
#ifndef timespecsub
#define timespecsub(tsp, usp, vsp) \
do { \
(vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \
(vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \
if ((vsp)->tv_nsec < 0) { \
(vsp)->tv_sec--; \
(vsp)->tv_nsec += 1000000000L; \
} \
} while (0)
#endif