mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-24 07:01:09 +02:00
util: Add count_seconds time helper
This commit is contained in:
@@ -10,6 +10,14 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <chrono>
|
#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
|
* DEPRECATED
|
||||||
* Use either GetSystemTimeInSeconds (not mockable) or GetTime<T> (mockable)
|
* Use either GetSystemTimeInSeconds (not mockable) or GetTime<T> (mockable)
|
||||||
|
Reference in New Issue
Block a user