summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2011-02-08 23:42:18 +0000
committerVincent Sanders <vince@netsurf-browser.org>2011-02-08 23:42:18 +0000
commit3c414e7668d6db3ac738f8850b9e038495ee5e3a (patch)
tree8466e11aee8f959aeace604cf801fe85e1ef7319 /utils
parent42990ed9ec37680791c88504595243f269f726c7 (diff)
downloadnetsurf-3c414e7668d6db3ac738f8850b9e038495ee5e3a.tar.gz
netsurf-3c414e7668d6db3ac738f8850b9e038495ee5e3a.tar.bz2
Stop win32 frontend using 100% cpu time when idle
svn path=/trunk/netsurf/; revision=11633
Diffstat (limited to 'utils')
-rw-r--r--utils/config.h2
-rw-r--r--utils/utils.h25
2 files changed, 26 insertions, 1 deletions
diff --git a/utils/config.h b/utils/config.h
index b05785390..8b6ce900a 100644
--- a/utils/config.h
+++ b/utils/config.h
@@ -50,7 +50,7 @@ char *strchrnul(const char *s, int c);
#define HAVE_INETATON
#if (defined(_WIN32))
#undef HAVE_INETATON
-#include <winsock.h>
+#include <winsock2.h>
#define EAFNOSUPPORT WSAEAFNOSUPPORT
int inet_aton(const char *cp, struct in_addr *inp);
#else
diff --git a/utils/utils.h b/utils/utils.h
index 84322156e..079708843 100644
--- a/utils/utils.h
+++ b/utils/utils.h
@@ -91,6 +91,31 @@ typedef struct
#define nsmkdir(dir, mode) mkdir((dir))
#endif
+#ifndef timeradd
+#define timeradd(a, aa, result) \
+ do { \
+ (result)->tv_sec = (a)->tv_sec + (aa)->tv_sec; \
+ (result)->tv_usec = (a)->tv_usec + (aa)->tv_usec; \
+ if ((result)->tv_usec >= 1000000) { \
+ ++(result)->tv_sec; \
+ (result)->tv_usec -= 1000000; \
+ } \
+ } while (0)
+#endif
+
+#ifndef timersub
+#define timersub(a, aa, result) \
+ do { \
+ (result)->tv_sec = (a)->tv_sec - (aa)->tv_sec; \
+ (result)->tv_usec = (a)->tv_usec - (aa)->tv_usec; \
+ if ((result)->tv_usec < 0) { \
+ --(result)->tv_sec; \
+ (result)->tv_usec += 1000000; \
+ } \
+ } while (0)
+#endif
+
+
/**
* Private-word-capable realloc() implementation which
* behaves as most NS libraries expect in the face of