diff options
-rw-r--r-- | include/compat/time.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/compat/time.h b/include/compat/time.h index 99a2001..df65530 100644 --- a/include/compat/time.h +++ b/include/compat/time.h | |||
@@ -21,3 +21,15 @@ struct tm *__gmtime_r(const time_t * t, struct tm * tm); | |||
21 | #ifndef HAVE_TIMEGM | 21 | #ifndef HAVE_TIMEGM |
22 | time_t timegm(struct tm *tm); | 22 | time_t timegm(struct tm *tm); |
23 | #endif | 23 | #endif |
24 | |||
25 | #ifndef timespecsub | ||
26 | #define timespecsub(tsp, usp, vsp) \ | ||
27 | do { \ | ||
28 | (vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \ | ||
29 | (vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \ | ||
30 | if ((vsp)->tv_nsec < 0) { \ | ||
31 | (vsp)->tv_sec--; \ | ||
32 | (vsp)->tv_nsec += 1000000000L; \ | ||
33 | } \ | ||
34 | } while (0) | ||
35 | #endif | ||