mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-11 22:43:06 +02:00
refactor: gui: Accept up to nanoseconds in formatDurationStr, but clarify they are ignored
This refactor does not change any behavior. However, it helps future commits to avoid having to place manual std::chrono::duration_cast<std::chrono::seconds> when calling this function.
This commit is contained in:
@@ -728,7 +728,7 @@ QString ConnectionTypeToQString(ConnectionType conn_type, bool prepend_direction
|
||||
assert(false);
|
||||
}
|
||||
|
||||
QString formatDurationStr(std::chrono::seconds dur)
|
||||
QString formatDurationStr(std::chrono::nanoseconds dur)
|
||||
{
|
||||
const auto d{std::chrono::duration_cast<std::chrono::days>(dur)};
|
||||
const auto h{std::chrono::duration_cast<std::chrono::hours>(dur - d)};
|
||||
|
||||
@@ -228,8 +228,8 @@ namespace GUIUtil
|
||||
/** Convert enum ConnectionType to QString */
|
||||
QString ConnectionTypeToQString(ConnectionType conn_type, bool prepend_direction);
|
||||
|
||||
/** Convert seconds into a QString with days, hours, mins, secs */
|
||||
QString formatDurationStr(std::chrono::seconds dur);
|
||||
/// Convert a duration into a QString with days, hours, mins, secs. This ignores sub-seconds.
|
||||
QString formatDurationStr(std::chrono::nanoseconds dur);
|
||||
|
||||
/** Convert peer connection time to a QString denominated in the most relevant unit. */
|
||||
QString FormatPeerAge(std::chrono::seconds time_connected);
|
||||
|
||||
Reference in New Issue
Block a user