/src/libzmq/src/polling_util.cpp
Line | Count | Source |
1 | | /* SPDX-License-Identifier: MPL-2.0 */ |
2 | | |
3 | | #include "precompiled.hpp" |
4 | | #include "polling_util.hpp" |
5 | | |
6 | | #if defined ZMQ_POLL_BASED_ON_POLL |
7 | | #include <limits.h> |
8 | | #include <algorithm> |
9 | | |
10 | | zmq::timeout_t zmq::compute_timeout (const bool first_pass_, |
11 | | const long timeout_, |
12 | | const uint64_t now_, |
13 | | const uint64_t end_) |
14 | 0 | { |
15 | 0 | if (first_pass_) |
16 | 0 | return 0; |
17 | | |
18 | 0 | if (timeout_ < 0) |
19 | 0 | return -1; |
20 | | |
21 | 0 | return static_cast<zmq::timeout_t> ( |
22 | | std::min<uint64_t> (end_ - now_, INT_MAX)); |
23 | 0 | } |
24 | | #endif |