mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-20 14:05:23 +01:00
util: Add count_microseconds helper
This commit is contained in:
parent
62948caf44
commit
faab4aaf2f
1 changed files with 7 additions and 2 deletions
|
@ -15,10 +15,15 @@ void UninterruptibleSleep(const std::chrono::microseconds& n);
|
|||
/**
|
||||
* Helper to count the seconds of a duration.
|
||||
*
|
||||
* All durations should be using std::chrono and calling this should generally be avoided in code. Though, it is still
|
||||
* preferred to an inline t.count() to protect against a reliance on the exact type of t.
|
||||
* All durations should be using std::chrono and calling this should generally
|
||||
* be avoided in code. Though, it is still preferred to an inline t.count() to
|
||||
* protect against a reliance on the exact type of t.
|
||||
*
|
||||
* This helper is used to convert durations before passing them over an
|
||||
* interface that doesn't support std::chrono (e.g. RPC, debug log, or the GUI)
|
||||
*/
|
||||
inline int64_t count_seconds(std::chrono::seconds t) { return t.count(); }
|
||||
inline int64_t count_microseconds(std::chrono::microseconds t) { return t.count(); }
|
||||
|
||||
/**
|
||||
* DEPRECATED
|
||||
|
|
Loading…
Add table
Reference in a new issue