mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-21 14:34:49 +01:00
util: Add UnintrruptibleSleep
This commit is contained in:
parent
36f42e1bf4
commit
fa4620be78
2 changed files with 7 additions and 1 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#include <string>
|
||||
#include <chrono>
|
||||
|
||||
void UninterruptibleSleep(const std::chrono::microseconds& n);
|
||||
|
||||
/**
|
||||
* Helper to count the seconds of a duration.
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue