aboutsummaryrefslogtreecommitdiff
path: root/src/qt/rpcconsole.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-12-10 10:02:03 +0100
committerMarcoFalke <falke.marco@gmail.com>2021-12-10 10:02:12 +0100
commit9f7661c0c4cbed06c558c2c8688c0a7286c5a6e2 (patch)
tree7d34ed083d7b9d323d515f516cec7087df4d881e /src/qt/rpcconsole.cpp
parentd5724b8c6a1f542edc0b02b6bd069121e2cd2542 (diff)
parentfadc0c80ae4e526fb2b503f7cc02f6122aaf1de5 (diff)
Merge bitcoin/bitcoin#19499: p2p: Make timeout mockable and type safe, speed up test
fadc0c80ae4e526fb2b503f7cc02f6122aaf1de5 p2p: Make timeout mockable and type safe, speed up test (MarcoFalke) fa6d5a238d2c94440105ddd4f1554f85659d6c5b scripted-diff: Rename m_last_send and m_last_recv (MarcoFalke) Pull request description: Use type-safe time for better code readability/maintainability and mockable time for better testability. This speeds up the p2p_timeout test. This is also a bugfix for intermittent test issues like: https://cirrus-ci.com/task/4769904156999680?command=ci#L2836 Fixes #20654 ACKs for top commit: laanwj: Code review ACK fadc0c80ae4e526fb2b503f7cc02f6122aaf1de5 naumenkogs: ACK fadc0c80ae4e526fb2b503f7cc02f6122aaf1de5 Tree-SHA512: 28c6544c97f188c8a0fbc80411c74ab74ffd055885322c325aa3d1c404b29c3fd70a737e86083eecae58ef394db1cb56bc122d06cff63742aa89a8e868730c64
Diffstat (limited to 'src/qt/rpcconsole.cpp')
-rw-r--r--src/qt/rpcconsole.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index 1c19fb4b27..5d08aff6b9 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -1141,7 +1141,7 @@ void RPCConsole::on_sldGraphRange_valueChanged(int value)
void RPCConsole::setTrafficGraphRange(int mins)
{
ui->trafficGraph->setGraphRangeMins(mins);
- ui->lblGraphRange->setText(GUIUtil::formatDurationStr(mins * 60));
+ ui->lblGraphRange->setText(GUIUtil::formatDurationStr(std::chrono::minutes{mins}));
}
void RPCConsole::updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut)
@@ -1172,12 +1172,12 @@ 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{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));
- ui->peerLastSend->setText(TimeDurationField(time_now, stats->nodeStats.nLastSend));
- ui->peerLastRecv->setText(TimeDurationField(time_now, stats->nodeStats.nLastRecv));
+ const auto time_now{GetTime<std::chrono::seconds>()};
+ ui->peerConnTime->setText(GUIUtil::formatDurationStr(time_now - std::chrono::seconds{stats->nodeStats.nTimeConnected}));
+ ui->peerLastBlock->setText(TimeDurationField(time_now, std::chrono::seconds{stats->nodeStats.nLastBlockTime}));
+ ui->peerLastTx->setText(TimeDurationField(time_now, std::chrono::seconds{stats->nodeStats.nLastTXTime}));
+ ui->peerLastSend->setText(TimeDurationField(time_now, stats->nodeStats.m_last_send));
+ ui->peerLastRecv->setText(TimeDurationField(time_now, stats->nodeStats.m_last_recv));
ui->peerBytesSent->setText(GUIUtil::formatBytes(stats->nodeStats.nSendBytes));
ui->peerBytesRecv->setText(GUIUtil::formatBytes(stats->nodeStats.nRecvBytes));
ui->peerPingTime->setText(GUIUtil::formatPingTime(stats->nodeStats.m_last_ping_time));