From 7330002960d2c89081614ef5d15f2f5181e5886c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 30 Dec 2008 19:10:08 +0100 Subject: utils: implement my_usleep() with Sleep() on WIN32 Sleep() has only millisecond granularity, but good enough for now. --- src/utils.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/utils.c b/src/utils.c index 9f00e687a..9ba95e5fa 100644 --- a/src/utils.c +++ b/src/utils.c @@ -36,6 +36,10 @@ #include #endif +#ifdef WIN32 +#include +#endif + void stripReturnChar(char *string) { while (string && (string = strchr(string, '\n'))) { @@ -45,12 +49,16 @@ void stripReturnChar(char *string) void my_usleep(long usec) { +#ifdef WIN32 + Sleep(usec / 1000); +#else struct timeval tv; tv.tv_sec = 0; tv.tv_usec = usec; select(0, NULL, NULL, NULL, &tv); +#endif } int ipv6Supported(void) -- cgit v1.2.3