mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 02:25:40 +01:00
util: Add count_seconds time helper
This commit is contained in:
parent
1111170f2f
commit
faaa1f01da
@ -10,6 +10,14 @@
|
||||
#include <string>
|
||||
#include <chrono>
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
inline int64_t count_seconds(std::chrono::seconds t) { return t.count(); }
|
||||
|
||||
/**
|
||||
* DEPRECATED
|
||||
* Use either GetSystemTimeInSeconds (not mockable) or GetTime<T> (mockable)
|
||||
|
Loading…
Reference in New Issue
Block a user