File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -1120,11 +1120,12 @@ void RPCConsole::updateDetailWidget()
1120
1120
if (stats->nodeStats .m_bip152_highbandwidth_from ) bip152_hb_settings += (bip152_hb_settings == " " ? " From" : " /From" );
1121
1121
if (bip152_hb_settings == " " ) bip152_hb_settings = " No" ;
1122
1122
ui->peerHighBandwidth ->setText (bip152_hb_settings);
1123
- ui->peerLastSend ->setText (stats->nodeStats .nLastSend ? GUIUtil::formatDurationStr (GetSystemTimeInSeconds () - stats->nodeStats .nLastSend ) : tr (" never" ));
1124
- ui->peerLastRecv ->setText (stats->nodeStats .nLastRecv ? GUIUtil::formatDurationStr (GetSystemTimeInSeconds () - stats->nodeStats .nLastRecv ) : tr (" never" ));
1123
+ const int64_t time_now{GetSystemTimeInSeconds ()};
1124
+ ui->peerConnTime ->setText (GUIUtil::formatDurationStr (time_now - stats->nodeStats .nTimeConnected ));
1125
+ ui->peerLastSend ->setText (TimeDurationField (time_now, stats->nodeStats .nLastSend ));
1126
+ ui->peerLastRecv ->setText (TimeDurationField (time_now, stats->nodeStats .nLastRecv ));
1125
1127
ui->peerBytesSent ->setText (GUIUtil::formatBytes (stats->nodeStats .nSendBytes ));
1126
1128
ui->peerBytesRecv ->setText (GUIUtil::formatBytes (stats->nodeStats .nRecvBytes ));
1127
- ui->peerConnTime ->setText (GUIUtil::formatDurationStr (GetSystemTimeInSeconds () - stats->nodeStats .nTimeConnected ));
1128
1129
ui->peerPingTime ->setText (GUIUtil::formatPingTime (stats->nodeStats .m_ping_usec ));
1129
1130
ui->peerMinPing ->setText (GUIUtil::formatPingTime (stats->nodeStats .m_min_ping_usec ));
1130
1131
ui->timeoffset ->setText (GUIUtil::formatTimeOffset (stats->nodeStats .nTimeOffset ));
Original file line number Diff line number Diff line change @@ -168,6 +168,11 @@ public Q_SLOTS:
168
168
/* * Update UI with latest network info from model. */
169
169
void updateNetworkState ();
170
170
171
+ /* * Helper for the output of a time duration field. Inputs are UNIX epoch times. */
172
+ QString TimeDurationField (uint64_t time_now, uint64_t time_at_event) const {
173
+ return time_at_event ? GUIUtil::formatDurationStr (time_now - time_at_event) : tr (" Never" );
174
+ }
175
+
171
176
private Q_SLOTS:
172
177
void updateAlerts (const QString& warnings);
173
178
};
You can’t perform that action at this time.
0 commit comments