aboutsummaryrefslogtreecommitdiff
path: root/src/util/time.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter@wuille.net>2020-09-29 19:11:53 -0700
committerDhruv Mehta <856960+dhruv@users.noreply.github.com>2021-03-03 09:48:07 -0800
commit4d98b401fbd821700f7a792b0a4cb52c9b71bc9f (patch)
treeb343ca6c143006fa595d72d56b14d74c008aae7f /src/util/time.h
parentcabe63759ce890a7d39d72f7b8046195b0edb421 (diff)
Change all ping times to std::chrono types
Diffstat (limited to 'src/util/time.h')
-rw-r--r--src/util/time.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/util/time.h b/src/util/time.h
index 56131ce0fe..9b418637c3 100644
--- a/src/util/time.h
+++ b/src/util/time.h
@@ -30,6 +30,13 @@ inline int64_t count_seconds(std::chrono::seconds t) { return t.count(); }
inline int64_t count_milliseconds(std::chrono::milliseconds t) { return t.count(); }
inline int64_t count_microseconds(std::chrono::microseconds t) { return t.count(); }
+using SecondsDouble = std::chrono::duration<double, std::chrono::seconds::period>;
+
+/**
+ * Helper to count the seconds in any std::chrono::duration type
+ */
+inline double CountSecondsDouble(SecondsDouble t) { return t.count(); }
+
/**
* DEPRECATED
* Use either GetSystemTimeInSeconds (not mockable) or GetTime<T> (mockable)