diff --git a/tests/server/util.c b/tests/server/util.c index b8a47b1fbb..c36f8eade3 100644 --- a/tests/server/util.c +++ b/tests/server/util.c @@ -54,6 +54,7 @@ #include "getpart.h" #include "util.h" #include "timeval.h" +#include "timediff.h" #ifdef USE_WINSOCK #undef EINTR @@ -221,6 +222,19 @@ FILE *test2fopen(long testno, const char *logdir2) return stream; } +#if !defined(MSDOS) && !defined(USE_WINSOCK) +static long timediff(struct timeval newer, struct timeval older) +{ + timediff_t diff = newer.tv_sec-older.tv_sec; + if(diff >= (LONG_MAX/1000)) + return LONG_MAX; + else if(diff <= (LONG_MIN/1000)) + return LONG_MIN; + return (long)(newer.tv_sec-older.tv_sec)*1000+ + (long)(newer.tv_usec-older.tv_usec)/1000; +} +#endif + /* * Portable function used for waiting a specific amount of ms. * Waiting indefinitely with this function is not allowed, a @@ -457,17 +471,6 @@ static struct timeval tvnow(void) #endif -long timediff(struct timeval newer, struct timeval older) -{ - timediff_t diff = newer.tv_sec-older.tv_sec; - if(diff >= (LONG_MAX/1000)) - return LONG_MAX; - else if(diff <= (LONG_MIN/1000)) - return LONG_MIN; - return (long)(newer.tv_sec-older.tv_sec)*1000+ - (long)(newer.tv_usec-older.tv_usec)/1000; -} - /* vars used to keep around previous signal handlers */ typedef void (*SIGHANDLER_T)(int); diff --git a/tests/server/util.h b/tests/server/util.h index 69121c587f..105e4f73c1 100644 --- a/tests/server/util.h +++ b/tests/server/util.h @@ -37,7 +37,6 @@ enum { char *data_to_hex(char *data, size_t len); void logmsg(const char *msg, ...) CURL_PRINTF(1, 2); -long timediff(struct timeval newer, struct timeval older); #define SERVERLOGS_LOCKDIR "lock" /* within logdir */