commit 36d33900b74d1d5c172a9a7b18331cdb4c1cb3db
parent 90ca92b4c841b3a16334e888eabb6c51fda4108d
Author: Frederic Cambus <fred@statdns.com>
Date: Thu, 3 Jan 2019 12:46:15 +0100
Define timespecsub macro in compat.h if it doesn't exists.
Diffstat:
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/compat/compat.h b/compat/compat.h
@@ -0,0 +1,16 @@
+#ifndef COMPAT_H
+#define COMPAT_H
+
+#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
+
+#endif /* COMPAT_H */
diff --git a/src/statzone.c b/src/statzone.c
@@ -21,6 +21,7 @@
#include <string.h>
#include <time.h>
+#include "compat.h"
#include "config.h"
struct timespec begin, end, elapsed;