|
|
@ -30,6 +30,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 <ws2tcpip.h> |
|
|
|
# include <ws2tcpip.h> |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -825,6 +826,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; |
|
|
@ -833,6 +837,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 */ |
|
|
|