From fa4620be782c2bf6b5ffddf4f671194fdd1536f3 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Fri, 21 Feb 2020 09:19:57 -0800 Subject: [PATCH] util: Add UnintrruptibleSleep --- src/util/time.cpp | 6 +++++- src/util/time.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/util/time.cpp b/src/util/time.cpp index 2afff2626b6..5c1182850e0 100644 --- a/src/util/time.cpp +++ b/src/util/time.cpp @@ -13,8 +13,12 @@ #include #include #include +#include + #include +void UninterruptibleSleep(const std::chrono::microseconds& n) { std::this_thread::sleep_for(n); } + static std::atomic nMockTime(0); //!< For unit testing int64_t GetTime() @@ -124,4 +128,4 @@ int64_t ParseISO8601DateTime(const std::string& str) if (ptime.is_not_a_date_time() || epoch > ptime) return 0; return (ptime - epoch).total_seconds(); -} \ No newline at end of file +} diff --git a/src/util/time.h b/src/util/time.h index af4390aa1c1..445ca3acb3e 100644 --- a/src/util/time.h +++ b/src/util/time.h @@ -10,6 +10,8 @@ #include #include +void UninterruptibleSleep(const std::chrono::microseconds& n); + /** * Helper to count the seconds of a duration. *