diff --git a/src/util/time.h b/src/util/time.h index e4f9996777c..c0470a2136c 100644 --- a/src/util/time.h +++ b/src/util/time.h @@ -10,6 +10,14 @@ #include #include +/** + * 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 (mockable)