From: Guus Sliepen Date: Mon, 3 Dec 2012 09:41:28 +0000 (+0100) Subject: More fixes for Windows. X-Git-Tag: release-1.1pre4~7 X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=75c619e372f02f8225d158fd514f01bd04857d3b;p=tinc More fixes for Windows. In particular, Windows does support many of the timer* macros, except timeradd and timersub. --- diff --git a/src/dropin.h b/src/dropin.h index c6cabba6..61143eb8 100644 --- a/src/dropin.h +++ b/src/dropin.h @@ -45,4 +45,22 @@ extern int gettimeofday(struct timeval *, void *); extern int usleep(long long usec); #endif +#ifndef timeradd +#define timeradd(a, b, r) do {\ + (r)->tv_sec = (a)->tv_sec + (b)->tv_sec;\ + (r)->tv_usec = (a)->tv_usec + (b)->tv_usec;\ + if((r)->tv_usec >= 1000000)\ + (r)->tv_sec++, (r)->tv_usec -= 1000000;\ +} while (0) +#endif + +#ifndef timersub +#define timersub(a, b, r) do {\ + (r)->tv_sec = (a)->tv_sec - (b)->tv_sec;\ + (r)->tv_usec = (a)->tv_usec - (b)->tv_usec;\ + if((r)->tv_usec < 1000000)\ + (r)->tv_sec--, (r)->tv_usec += 1000000;\ +} while (0) +#endif + #endif /* __DROPIN_H__ */ diff --git a/src/event.c b/src/event.c index 44a1f878..0dde994f 100644 --- a/src/event.c +++ b/src/event.c @@ -19,6 +19,7 @@ #include "system.h" +#include "dropin.h" #include "event.h" #include "net.h" #include "utils.h" diff --git a/src/process.c b/src/process.c index 1093ea8f..2fd3d936 100644 --- a/src/process.c +++ b/src/process.c @@ -25,6 +25,7 @@ #include "control.h" #include "device.h" #include "edge.h" +#include "event.h" #include "logger.h" #include "net.h" #include "node.h"