aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-12-13 12:02:10 +0100
committerMarcoFalke <falke.marco@gmail.com>2021-12-13 12:32:09 +0100
commitfad7ead146a152f46b25ce6623e05cbb1dbc8cca (patch)
tree3eb7c696b2d23d76dda3b6b95e819efc9e826d80 /src/net.h
parenteb63b8fab91c3aec46ef4ae66e6241ed5de49bbd (diff)
downloadbitcoin-fad7ead146a152f46b25ce6623e05cbb1dbc8cca.tar.xz
refactor: Use type-safe std::chrono in net
Diffstat (limited to 'src/net.h')
-rw-r--r--src/net.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/net.h b/src/net.h
index 3c03f7f9da..fdcdec7939 100644
--- a/src/net.h
+++ b/src/net.h
@@ -243,9 +243,9 @@ public:
bool fRelayTxes;
std::chrono::seconds m_last_send;
std::chrono::seconds m_last_recv;
- int64_t nLastTXTime;
- int64_t nLastBlockTime;
- int64_t nTimeConnected;
+ std::chrono::seconds nLastTXTime;
+ std::chrono::seconds nLastBlockTime;
+ std::chrono::seconds nTimeConnected;
int64_t nTimeOffset;
std::string m_addr_name;
int nVersion;
@@ -422,8 +422,8 @@ public:
std::atomic<std::chrono::seconds> m_last_send{0s};
std::atomic<std::chrono::seconds> m_last_recv{0s};
- //! Unix epoch time at peer connection, in seconds.
- const int64_t nTimeConnected;
+ //! Unix epoch time at peer connection
+ const std::chrono::seconds nTimeConnected;
std::atomic<int64_t> nTimeOffset{0};
// Address of this peer
const CAddress addr;
@@ -562,13 +562,13 @@ public:
* preliminary validity checks and was saved to disk, even if we don't
* connect the block or it eventually fails connection. Used as an inbound
* peer eviction criterium in CConnman::AttemptToEvictConnection. */
- std::atomic<int64_t> nLastBlockTime{0};
+ std::atomic<std::chrono::seconds> nLastBlockTime{0s};
/** UNIX epoch time of the last transaction received from this peer that we
* had not yet seen (e.g. not already received from another peer) and that
* was accepted into our mempool. Used as an inbound peer eviction criterium
* in CConnman::AttemptToEvictConnection. */
- std::atomic<int64_t> nLastTXTime{0};
+ std::atomic<std::chrono::seconds> nLastTXTime{0s};
/** Last measured round-trip time. Used only for RPC/GUI stats/debugging.*/
std::atomic<std::chrono::microseconds> m_last_ping_time{0us};
@@ -1274,10 +1274,10 @@ void CaptureMessage(const CAddress& addr, const std::string& msg_type, const Spa
struct NodeEvictionCandidate
{
NodeId id;
- int64_t nTimeConnected;
+ std::chrono::seconds nTimeConnected;
std::chrono::microseconds m_min_ping_time;
- int64_t nLastBlockTime;
- int64_t nLastTXTime;
+ std::chrono::seconds nLastBlockTime;
+ std::chrono::seconds nLastTXTime;
bool fRelevantServices;
bool fRelayTxes;
bool fBloomFilter;