From 3c414e7668d6db3ac738f8850b9e038495ee5e3a Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Tue, 8 Feb 2011 23:42:18 +0000 Subject: Stop win32 frontend using 100% cpu time when idle svn path=/trunk/netsurf/; revision=11633 --- utils/config.h | 2 +- utils/utils.h | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) (limited to 'utils') 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 +#include #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 -- cgit v1.2.3