util: Add count_seconds time helper

This commit is contained in:
MarcoFalke 2019-09-19 10:57:27 -04:00
parent 1111170f2f
commit faaa1f01da
No known key found for this signature in database
GPG Key ID: CE2B75697E69A548

View File

@ -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)