summaryrefslogtreecommitdiff
path: root/acconfig.h
diff options
context:
space:
mode:
Diffstat (limited to 'acconfig.h')
-rw-r--r--acconfig.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/acconfig.h b/acconfig.h
index a37c0823..db7fd18b 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -71,6 +71,10 @@
# include <paths.h> /* For _PATH_XXX */
#endif
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h> /* For timersub */
+#endif
+
#ifndef SHUT_RDWR
enum
{
@@ -178,3 +182,16 @@ enum
# define MAX(a,b) (((a)>(b))?(a):(b))
# define MIN(a,b) (((a)<(b))?(a):(b))
#endif
+
+#ifndef timersub
+#define timersub(a, b, result) \
+ do { \
+ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
+ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
+ if ((result)->tv_usec < 0) { \
+ --(result)->tv_sec; \
+ (result)->tv_usec += 1000000; \
+ } \
+ } while (0)
+
+#endif