Skip to content

Commit

Permalink
util: Add UnintrruptibleSleep
Browse files Browse the repository at this point in the history
Cherry-picked from: fa4620b
  • Loading branch information
xanimo committed Mar 30, 2024
1 parent 7d4f9ab commit 1d65ba3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/utiltime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@
#include <atomic>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/thread.hpp>
#include <ctime>
#include <thread>

using namespace std;

void UninterruptibleSleep(const std::chrono::microseconds& n) { std::this_thread::sleep_for(n); }

static std::atomic<int64_t> nMockTime(0); //!< For testing

int64_t GetTime()
Expand Down
3 changes: 3 additions & 0 deletions src/utiltime.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

#include <stdint.h>
#include <string>
#include <chrono>

void UninterruptibleSleep(const std::chrono::microseconds& n);

/**
* GetTimeMicros() and GetTimeMillis() both return the system time, but in
Expand Down

0 comments on commit 1d65ba3

Please sign in to comment.