aboutsummaryrefslogtreecommitdiff
path: root/src/qt/rpcconsole.h
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2021-02-24 16:12:43 +0100
committerJon Atack <jon@atack.com>2021-02-25 11:32:51 +0100
commit4dc2fd6c37f8d85c2e9f19d5f03c72c5a1707455 (patch)
tree3643095caa2d3141baf90b46ba5176c6a61cad90 /src/qt/rpcconsole.h
parentb54a10e777f912081e5c00dabcf3643b10775a50 (diff)
downloadbitcoin-4dc2fd6c37f8d85c2e9f19d5f03c72c5a1707455.tar.xz
qt: add RPCConsole::TimeDurationField helper, call systime only once
Diffstat (limited to 'src/qt/rpcconsole.h')
-rw-r--r--src/qt/rpcconsole.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h
index 5f308dc36d..27d4c42eb4 100644
--- a/src/qt/rpcconsole.h
+++ b/src/qt/rpcconsole.h
@@ -168,6 +168,11 @@ private:
/** Update UI with latest network info from model. */
void updateNetworkState();
+ /** Helper for the output of a time duration field. Inputs are UNIX epoch times. */
+ QString TimeDurationField(uint64_t time_now, uint64_t time_at_event) const {
+ return time_at_event ? GUIUtil::formatDurationStr(time_now - time_at_event) : tr("Never");
+ }
+
private Q_SLOTS:
void updateAlerts(const QString& warnings);
};