summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinun Dragonation <minun@mewmew.cn>2019-05-05 21:58:34 +0800
committerMinun Dragonation <minun@mewmew.cn>2019-05-05 21:58:34 +0800
commitf5454d509f9eafef35714c4e5e23af066e80f4f6 (patch)
tree26d1588c1fcf2c861b2fdf33a95656d485b996fb
parent4a94ce6326c51a2071025e929a3ab2a5263206f7 (diff)
fix bugs on socket timeout tv usec calculation
-rw-r--r--sockcompat.c2
1 files changed, 1 insertions, 1 deletions
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;
}