From f5454d509f9eafef35714c4e5e23af066e80f4f6 Mon Sep 17 00:00:00 2001 From: Minun Dragonation Date: Sun, 5 May 2019 21:58:34 +0800 Subject: fix bugs on socket timeout tv usec calculation --- sockcompat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sockcompat.c b/sockcompat.c index 38cb9e5..c3b6f66 100644 --- a/sockcompat.c +++ b/sockcompat.c @@ -197,7 +197,7 @@ int win32_getsockopt(SOCKET sockfd, int level, int optname, void *optval, sockle socklen_t dwlen = 0; ret = getsockopt(sockfd, level, optname, (char *)&timeout, &dwlen); tv->tv_sec = timeout / 1000; - tv->tv_usec = timeout * 1000; + tv->tv_usec = (timeout * 1000) % 1000000; } else { ret = WSAEFAULT; } -- cgit v1.2.3