diff options
author | Bryan Drewery <bryan@shatow.net> | 2020-04-28 22:35:08 +0300 |
---|---|---|
committer | Bryan Drewery <bryan@shatow.net> | 2020-04-28 22:35:08 +0300 |
commit | c74216b285b785cefc5a3b552cadaa10e0602c20 (patch) | |
tree | 087f75d718b51eae71c3d3178aea032d09a59df9 | |
parent | 367331f365bb1fd5b7724ac5783d7f84d247292d (diff) |
timespecsub is only in 12.0+
-rw-r--r-- | src/libexec/poudriere/timestamp/timestamp.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libexec/poudriere/timestamp/timestamp.c b/src/libexec/poudriere/timestamp/timestamp.c index 3a913123..b36cb80e 100644 --- a/src/libexec/poudriere/timestamp/timestamp.c +++ b/src/libexec/poudriere/timestamp/timestamp.c @@ -43,6 +43,17 @@ #include <unistd.h> #define min(a, b) ((a) > (b) ? (b) : (a)) +#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 static struct timespec start; |