compat.h (600B)
1 #ifndef COMPAT_H 2 #define COMPAT_H 3 4 #ifndef HAVE_PLEDGE 5 #include "pledge.h" 6 #endif 7 8 #ifndef HAVE_STRTONUM 9 #include "strtonum.h" 10 #endif 11 12 /* Use CLOCK_REALTIME if CLOCK_MONOTONIC is not available */ 13 #ifndef CLOCK_MONOTONIC 14 #define CLOCK_MONOTONIC CLOCK_REALTIME 15 #endif 16 17 #ifndef timespecsub 18 #define timespecsub(tsp, usp, vsp) \ 19 do { \ 20 (vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \ 21 (vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \ 22 if ((vsp)->tv_nsec < 0) { \ 23 (vsp)->tv_sec--; \ 24 (vsp)->tv_nsec += 1000000000L; \ 25 } \ 26 } while (0) 27 #endif 28 29 #endif /* COMPAT_H */