Skip to content

Commit fa11110

Browse files
author
MarcoFalke
committed
util: Allow use of C++14 chrono literals
1 parent 16b31cc commit fa11110

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

src/net.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ class CNode
10161016
// Used for BIP35 mempool sending
10171017
bool fSendMempool GUARDED_BY(cs_tx_inventory){false};
10181018
// Last time a "MEMPOOL" request was serviced.
1019-
std::atomic<std::chrono::seconds> m_last_mempool_req{std::chrono::seconds{0}};
1019+
std::atomic<std::chrono::seconds> m_last_mempool_req{0s};
10201020
std::chrono::microseconds nNextInvSend{0};
10211021

10221022
RecursiveMutex cs_feeFilter;
@@ -1049,7 +1049,7 @@ class CNode
10491049
// The pong reply we're expecting, or 0 if no pong expected.
10501050
std::atomic<uint64_t> nPingNonceSent{0};
10511051
/** When the last ping was sent, or 0 if no ping was ever sent */
1052-
std::atomic<std::chrono::microseconds> m_ping_start{std::chrono::microseconds{0}};
1052+
std::atomic<std::chrono::microseconds> m_ping_start{0us};
10531053
// Last measured round-trip time.
10541054
std::atomic<int64_t> nPingUsecTime{0};
10551055
// Best measured round-trip time.

src/net_processing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4080,7 +4080,7 @@ bool PeerManager::SendMessages(CNode* pto)
40804080
// over since our last self-announcement, but there is only a small
40814081
// bandwidth cost that we can incur by doing this (which happens
40824082
// once a day on average).
4083-
if (pto->m_next_local_addr_send != std::chrono::microseconds::zero()) {
4083+
if (pto->m_next_local_addr_send != 0us) {
40844084
pto->m_addr_known->reset();
40854085
}
40864086
AdvertiseLocal(pto);

src/randomenv.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void RandAddSeedPerfmon(CSHA512& hasher)
6969

7070
// This can take up to 2 seconds, so only do it every 10 minutes.
7171
// Initialize last_perfmon to 0 seconds, we don't skip the first call.
72-
static std::atomic<std::chrono::seconds> last_perfmon{std::chrono::seconds{0}};
72+
static std::atomic<std::chrono::seconds> last_perfmon{0s};
7373
auto last_time = last_perfmon.load();
7474
auto current_time = GetTime<std::chrono::seconds>();
7575
if (current_time < last_time + std::chrono::minutes{10}) return;

src/util/time.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
#ifndef BITCOIN_UTIL_TIME_H
77
#define BITCOIN_UTIL_TIME_H
88

9+
#include <chrono>
910
#include <stdint.h>
1011
#include <string>
11-
#include <chrono>
12+
13+
using namespace std::chrono_literals;
1214

1315
void UninterruptibleSleep(const std::chrono::microseconds& n);
1416

0 commit comments

Comments
 (0)