|
@@ -40,6 +40,7 @@
|
|
|
# include <netinet/tcp.h>
|
|
# include <netinet/tcp.h>
|
|
|
# include <netdb.h>
|
|
# include <netdb.h>
|
|
|
#else
|
|
#else
|
|
|
|
|
+# include <windows.h>
|
|
|
# include <winsock2.h>
|
|
# include <winsock2.h>
|
|
|
# include <mstcpip.h>
|
|
# include <mstcpip.h>
|
|
|
# include <ws2tcpip.h>
|
|
# include <ws2tcpip.h>
|
|
@@ -1044,6 +1045,9 @@ void nmsleep(unsigned int msecs)
|
|
|
int ret;
|
|
int ret;
|
|
|
ldiv_t d;
|
|
ldiv_t d;
|
|
|
|
|
|
|
|
|
|
+#ifdef WIN32
|
|
|
|
|
+ timeBeginPeriod(1);
|
|
|
|
|
+#endif
|
|
|
d = ldiv(msecs, 1000);
|
|
d = ldiv(msecs, 1000);
|
|
|
tleft.tv_sec = d.quot;
|
|
tleft.tv_sec = d.quot;
|
|
|
tleft.tv_nsec = d.rem * 1000000;
|
|
tleft.tv_nsec = d.rem * 1000000;
|
|
@@ -1052,6 +1056,9 @@ void nmsleep(unsigned int msecs)
|
|
|
twait.tv_nsec = tleft.tv_nsec;
|
|
twait.tv_nsec = tleft.tv_nsec;
|
|
|
ret = nanosleep(&twait, &tleft);
|
|
ret = nanosleep(&twait, &tleft);
|
|
|
} while (ret == -1 && errno == EINTR);
|
|
} while (ret == -1 && errno == EINTR);
|
|
|
|
|
+#ifdef WIN32
|
|
|
|
|
+ timeEndPeriod(1);
|
|
|
|
|
+#endif
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/* Returns the microseconds difference between end and start times as a double */
|
|
/* Returns the microseconds difference between end and start times as a double */
|