@@ -1729,7 +1729,7 @@ inline ssize_t select_read(socket_t sock, time_t sec, time_t usec) {
17291729 pfd_read.fd = sock;
17301730 pfd_read.events = POLLIN;
17311731
1732- auto timeout = static_cast <int >(sec * 1000 + usec);
1732+ auto timeout = static_cast <int >(sec * 1000 + usec / 1000 );
17331733
17341734 return handle_EINTR ([&]() { return poll (&pfd_read, 1 , timeout); });
17351735#else
@@ -1753,7 +1753,7 @@ inline ssize_t select_write(socket_t sock, time_t sec, time_t usec) {
17531753 pfd_read.fd = sock;
17541754 pfd_read.events = POLLOUT;
17551755
1756- auto timeout = static_cast <int >(sec * 1000 + usec);
1756+ auto timeout = static_cast <int >(sec * 1000 + usec / 1000 );
17571757
17581758 return handle_EINTR ([&]() { return poll (&pfd_read, 1 , timeout); });
17591759#else
@@ -1777,7 +1777,7 @@ inline bool wait_until_socket_is_ready(socket_t sock, time_t sec, time_t usec) {
17771777 pfd_read.fd = sock;
17781778 pfd_read.events = POLLIN | POLLOUT;
17791779
1780- auto timeout = static_cast <int >(sec * 1000 + usec);
1780+ auto timeout = static_cast <int >(sec * 1000 + usec / 1000 );
17811781
17821782 auto poll_res = handle_EINTR ([&]() { return poll (&pfd_read, 1 , timeout); });
17831783
@@ -1888,8 +1888,8 @@ inline bool keep_alive(socket_t sock) {
18881888 } else if (val == 0 ) {
18891889 auto current = steady_clock::now ();
18901890 auto duration = duration_cast<milliseconds>(current - start);
1891- auto timeout = CPPHTTPLIB_KEEPALIVE_TIMEOUT_SECOND * 100 +
1892- CPPHTTPLIB_KEEPALIVE_TIMEOUT_SECOND ;
1891+ auto timeout = CPPHTTPLIB_KEEPALIVE_TIMEOUT_SECOND * 1000 +
1892+ CPPHTTPLIB_KEEPALIVE_TIMEOUT_USECOND / 1000 ;
18931893 if (duration.count () > timeout) { return false ; }
18941894 std::this_thread::sleep_for (std::chrono::milliseconds (1 ));
18951895 } else {
0 commit comments