Changeset View
Changeset View
Standalone View
Standalone View
src/util/time.h
Show All 12 Lines | |||||
void UninterruptibleSleep(const std::chrono::microseconds &n); | void UninterruptibleSleep(const std::chrono::microseconds &n); | ||||
/** | /** | ||||
* Helper to count the seconds of a duration. | * Helper to count the seconds of a duration. | ||||
* | * | ||||
* All durations should be using std::chrono and calling this should generally | * 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 | * 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. | * 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) { | inline int64_t count_seconds(std::chrono::seconds t) { | ||||
return t.count(); | return t.count(); | ||||
} | } | ||||
inline int64_t count_microseconds(std::chrono::microseconds t) { | |||||
return t.count(); | |||||
} | |||||
/** | /** | ||||
* DEPRECATED | * DEPRECATED | ||||
* Use either GetSystemTimeInSeconds (not mockable) or GetTime<T> (mockable) | * Use either GetSystemTimeInSeconds (not mockable) or GetTime<T> (mockable) | ||||
*/ | */ | ||||
int64_t GetTime(); | int64_t GetTime(); | ||||
/** Returns the system time (not mockable) */ | /** Returns the system time (not mockable) */ | ||||
Show All 24 Lines |