diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2011-02-08 23:42:18 +0000 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2011-02-08 23:42:18 +0000 |
commit | 3c414e7668d6db3ac738f8850b9e038495ee5e3a (patch) | |
tree | 8466e11aee8f959aeace604cf801fe85e1ef7319 /utils/utils.h | |
parent | 42990ed9ec37680791c88504595243f269f726c7 (diff) | |
download | netsurf-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/utils.h')
-rw-r--r-- | utils/utils.h | 25 |
1 files changed, 25 insertions, 0 deletions
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 |