From feb72e5432e7a44b7f48cdab8da2c95edcec11c2 Mon Sep 17 00:00:00 2001 From: fanquake Date: Tue, 30 Mar 2021 15:19:01 +0800 Subject: scripted-diff: rename GetSystemTimeInSeconds to GetTimeSeconds -BEGIN VERIFY SCRIPT- sed -i -e 's/GetSystemTimeInSeconds/GetTimeSeconds/g' $(git grep -l GetSystemTimeInSeconds src) -END VERIFY SCRIPT- --- src/bitcoin-cli.cpp | 2 +- src/net.cpp | 8 ++++---- src/qt/rpcconsole.cpp | 2 +- src/test/util_tests.cpp | 2 +- src/util/time.cpp | 2 +- src/util/time.h | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 4a4710ea3a..c5840b2098 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -418,7 +418,7 @@ private: if (conn_type == "addr-fetch") return "addr"; return ""; } - const int64_t m_time_now{GetSystemTimeInSeconds()}; + const int64_t m_time_now{GetTimeSeconds()}; public: static constexpr int ID_PEERINFO = 0; diff --git a/src/net.cpp b/src/net.cpp index 1b6f04dead..dcb665354f 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -796,7 +796,7 @@ size_t CConnman::SocketSendData(CNode& node) const nBytes = send(node.hSocket, reinterpret_cast(data.data()) + node.nSendOffset, data.size() - node.nSendOffset, MSG_NOSIGNAL | MSG_DONTWAIT); } if (nBytes > 0) { - node.nLastSend = GetSystemTimeInSeconds(); + node.nLastSend = GetTimeSeconds(); node.nSendBytes += nBytes; node.nSendOffset += nBytes; nSentSize += nBytes; @@ -1251,7 +1251,7 @@ void CConnman::NotifyNumConnectionsChanged() bool CConnman::ShouldRunInactivityChecks(const CNode& node, std::optional now_in) const { - const int64_t now = now_in ? now_in.value() : GetSystemTimeInSeconds(); + const int64_t now = now_in ? now_in.value() : GetTimeSeconds(); return node.nTimeConnected + m_peer_connect_timeout < now; } @@ -1259,7 +1259,7 @@ bool CConnman::InactivityCheck(const CNode& node) const { // Use non-mockable system time (otherwise these timers will pop when we // use setmocktime in the tests). - int64_t now = GetSystemTimeInSeconds(); + int64_t now = GetTimeSeconds(); if (!ShouldRunInactivityChecks(node, now)) return false; @@ -2912,7 +2912,7 @@ ServiceFlags CConnman::GetLocalServices() const unsigned int CConnman::GetReceiveFloodSize() const { return nReceiveFloodSize; } CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, SOCKET hSocketIn, const CAddress& addrIn, uint64_t nKeyedNetGroupIn, uint64_t nLocalHostNonceIn, const CAddress& addrBindIn, const std::string& addrNameIn, ConnectionType conn_type_in, bool inbound_onion) - : nTimeConnected(GetSystemTimeInSeconds()), + : nTimeConnected(GetTimeSeconds()), addr(addrIn), addrBind(addrBindIn), m_inbound_onion(inbound_onion), diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 83a111e9c8..fa964a84ed 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -1079,7 +1079,7 @@ void RPCConsole::updateDetailWidget() if (stats->nodeStats.m_bip152_highbandwidth_from) bip152_hb_settings += (bip152_hb_settings.isEmpty() ? ts.from : QLatin1Char('/') + ts.from); if (bip152_hb_settings.isEmpty()) bip152_hb_settings = ts.no; ui->peerHighBandwidth->setText(bip152_hb_settings); - const int64_t time_now{GetSystemTimeInSeconds()}; + const int64_t time_now{GetTimeSeconds()}; ui->peerConnTime->setText(GUIUtil::formatDurationStr(time_now - stats->nodeStats.nTimeConnected)); ui->peerLastBlock->setText(TimeDurationField(time_now, stats->nodeStats.nLastBlockTime)); ui->peerLastTx->setText(TimeDurationField(time_now, stats->nodeStats.nLastTXTime)); diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp index aa95bc37e5..d463bcdd8e 100644 --- a/src/test/util_tests.cpp +++ b/src/test/util_tests.cpp @@ -182,7 +182,7 @@ BOOST_AUTO_TEST_CASE(util_FormatParseISO8601DateTime) BOOST_CHECK_EQUAL(ParseISO8601DateTime("1960-01-01T00:00:00Z"), 0); BOOST_CHECK_EQUAL(ParseISO8601DateTime("2011-09-30T23:36:17Z"), 1317425777); - auto time = GetSystemTimeInSeconds(); + auto time = GetTimeSeconds(); BOOST_CHECK_EQUAL(ParseISO8601DateTime(FormatISO8601DateTime(time)), time); } diff --git a/src/util/time.cpp b/src/util/time.cpp index e6f0986a39..eda710b12c 100644 --- a/src/util/time.cpp +++ b/src/util/time.cpp @@ -124,7 +124,7 @@ int64_t GetTimeMicros() return int64_t{GetSystemTime().count()}; } -int64_t GetSystemTimeInSeconds() +int64_t GetTimeSeconds() { return int64_t{GetSystemTime().count()}; } diff --git a/src/util/time.h b/src/util/time.h index 7ebcaaa339..4aee01967d 100644 --- a/src/util/time.h +++ b/src/util/time.h @@ -39,7 +39,7 @@ inline double CountSecondsDouble(SecondsDouble t) { return t.count(); } /** * DEPRECATED - * Use either GetSystemTimeInSeconds (not mockable) or GetTime (mockable) + * Use either GetTimeSeconds (not mockable) or GetTime (mockable) */ int64_t GetTime(); @@ -48,7 +48,7 @@ int64_t GetTimeMillis(); /** Returns the system time (not mockable) */ int64_t GetTimeMicros(); /** Returns the system time (not mockable) */ -int64_t GetSystemTimeInSeconds(); // Like GetTime(), but not mockable +int64_t GetTimeSeconds(); // Like GetTime(), but not mockable /** * DEPRECATED -- cgit v1.2.3