vcpkg/ports/clickhouse-cpp/fix-timeval.patch
2023-10-03 20:33:13 -07:00

18 lines
1.2 KiB
Diff

diff --git a/clickhouse/base/socket.cpp b/clickhouse/base/socket.cpp
index 48e90c7..73503fb 100644
--- a/clickhouse/base/socket.cpp
+++ b/clickhouse/base/socket.cpp
@@ -129,10 +129,10 @@ void SetNonBlock(SOCKET fd, bool value) {
void SetTimeout(SOCKET fd, const SocketTimeoutParams& timeout_params) {
#if defined(_unix_)
- timeval recv_timeout{ timeout_params.recv_timeout.count() / 1000, static_cast<int>(timeout_params.recv_timeout.count() % 1000 * 1000) };
+ timeval recv_timeout{ static_cast<time_t>(timeout_params.recv_timeout.count() / 1000), static_cast<suseconds_t>(timeout_params.recv_timeout.count() % 1000 * 1000) };
auto recv_ret = setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &recv_timeout, sizeof(recv_timeout));
- timeval send_timeout{ timeout_params.send_timeout.count() / 1000, static_cast<int>(timeout_params.send_timeout.count() % 1000 * 1000) };
+ timeval send_timeout{ static_cast<time_t>(timeout_params.send_timeout.count() / 1000), static_cast<suseconds_t>(timeout_params.send_timeout.count() % 1000 * 1000) };
auto send_ret = setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &send_timeout, sizeof(send_timeout));
if (recv_ret == -1 || send_ret == -1) {