diff options
| author | MarcoFalke <[email protected]> | 2020-02-21 09:19:57 -0800 |
|---|---|---|
| committer | MarcoFalke <[email protected]> | 2020-02-21 09:49:37 -0800 |
| commit | fa4620be782c2bf6b5ffddf4f671194fdd1536f3 (patch) | |
| tree | 38abb4235c76ec658fc4c23360fc4e66975041c3 /src/util/time.cpp | |
| parent | Merge #18037: Util: Allow scheduler to be mocked (diff) | |
| download | discoin-fa4620be782c2bf6b5ffddf4f671194fdd1536f3.tar.xz discoin-fa4620be782c2bf6b5ffddf4f671194fdd1536f3.zip | |
util: Add UnintrruptibleSleep
Diffstat (limited to 'src/util/time.cpp')
| -rw-r--r-- | src/util/time.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/util/time.cpp b/src/util/time.cpp index 2afff2626..5c1182850 100644 --- a/src/util/time.cpp +++ b/src/util/time.cpp @@ -13,8 +13,12 @@ #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/thread.hpp> #include <ctime> +#include <thread> + #include <tinyformat.h> +void UninterruptibleSleep(const std::chrono::microseconds& n) { std::this_thread::sleep_for(n); } + static std::atomic<int64_t> 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 +} |