]> git.meshlink.io Git - meshlink/commitdiff
More fixes for Windows.
authorGuus Sliepen <guus@tinc-vpn.org>
Mon, 3 Dec 2012 09:41:28 +0000 (10:41 +0100)
committerGuus Sliepen <guus@tinc-vpn.org>
Mon, 3 Dec 2012 09:41:28 +0000 (10:41 +0100)
In particular, Windows does support many of the timer* macros, except timeradd
and timersub.

src/dropin.h
src/event.c
src/process.c

index c6cabba6c17e1437f2be34ec4f1ae3ec5974e0cb..61143eb83c89d6ca251fd817da4ebbd9d49eba91 100644 (file)
@@ -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__ */
index 44a1f878a55a392a299c46f9efe115bb02f68fc6..0dde994f0ff160c0b3e2350fce1b2d9880e08c39 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "system.h"
 
+#include "dropin.h"
 #include "event.h"
 #include "net.h"
 #include "utils.h"
index 1093ea8f63049d431b3a9e6a564a1b48179681ad..2fd3d936da6757aaa9a22e43926d1717c887dfa5 100644 (file)
@@ -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"