diff options
-rw-r--r-- | src/netbase.cpp | 9 | ||||
-rw-r--r-- | src/netbase.h | 4 | ||||
-rw-r--r-- | src/torcontrol.cpp | 1 | ||||
-rw-r--r-- | src/util/time.cpp | 9 | ||||
-rw-r--r-- | src/util/time.h | 7 |
5 files changed, 18 insertions, 12 deletions
diff --git a/src/netbase.cpp b/src/netbase.cpp index 264029d8a2..93c395b9ec 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -10,6 +10,7 @@ #include <util/strencodings.h> #include <util/string.h> #include <util/system.h> +#include <util/time.h> #include <atomic> #include <cstdint> @@ -271,14 +272,6 @@ CService LookupNumeric(const std::string& name, int portDefault) return addr; } -struct timeval MillisToTimeval(int64_t nTimeout) -{ - struct timeval timeout; - timeout.tv_sec = nTimeout / 1000; - timeout.tv_usec = (nTimeout % 1000) * 1000; - return timeout; -} - /** SOCKS version */ enum SOCKSVersion: uint8_t { SOCKS4 = 0x04, diff --git a/src/netbase.h b/src/netbase.h index ac4cd97673..3dc656d0db 100644 --- a/src/netbase.h +++ b/src/netbase.h @@ -62,10 +62,6 @@ bool CloseSocket(SOCKET& hSocket); bool SetSocketNonBlocking(const SOCKET& hSocket, bool fNonBlocking); /** Set the TCP_NODELAY flag on a socket */ bool SetSocketNoDelay(const SOCKET& hSocket); -/** - * Convert milliseconds to a struct timeval for e.g. select. - */ -struct timeval MillisToTimeval(int64_t nTimeout); void InterruptSocks5(bool interrupt); #endif // BITCOIN_NETBASE_H diff --git a/src/torcontrol.cpp b/src/torcontrol.cpp index 90ee9422ba..208794a4e5 100644 --- a/src/torcontrol.cpp +++ b/src/torcontrol.cpp @@ -14,6 +14,7 @@ #include <netbase.h> #include <util/strencodings.h> #include <util/system.h> +#include <util/time.h> #include <vector> #include <deque> diff --git a/src/util/time.cpp b/src/util/time.cpp index e96972fe12..4da041e5a5 100644 --- a/src/util/time.cpp +++ b/src/util/time.cpp @@ -7,6 +7,7 @@ #include <config/bitcoin-config.h> #endif +#include <compat.h> #include <util/time.h> #include <atomic> @@ -114,3 +115,11 @@ int64_t ParseISO8601DateTime(const std::string& str) return 0; return (ptime - epoch).total_seconds(); } + +struct timeval MillisToTimeval(int64_t nTimeout) +{ + struct timeval timeout; + timeout.tv_sec = nTimeout / 1000; + timeout.tv_usec = (nTimeout % 1000) * 1000; + return timeout; +} diff --git a/src/util/time.h b/src/util/time.h index c69f604dc6..2c0e3d83f6 100644 --- a/src/util/time.h +++ b/src/util/time.h @@ -6,6 +6,8 @@ #ifndef BITCOIN_UTIL_TIME_H #define BITCOIN_UTIL_TIME_H +#include <compat.h> + #include <chrono> #include <stdint.h> #include <string> @@ -57,4 +59,9 @@ std::string FormatISO8601DateTime(int64_t nTime); std::string FormatISO8601Date(int64_t nTime); int64_t ParseISO8601DateTime(const std::string& str); +/** + * Convert milliseconds to a struct timeval for e.g. select. + */ +struct timeval MillisToTimeval(int64_t nTimeout); + #endif // BITCOIN_UTIL_TIME_H |