Changeset View
Changeset View
Standalone View
Standalone View
src/util/time.cpp
Show All 11 Lines | |||||
#include <boost/date_time/posix_time/posix_time.hpp> | #include <boost/date_time/posix_time/posix_time.hpp> | ||||
#include <boost/thread.hpp> | #include <boost/thread.hpp> | ||||
#include <tinyformat.h> | #include <tinyformat.h> | ||||
#include <atomic> | #include <atomic> | ||||
#include <ctime> | #include <ctime> | ||||
//!< For unit testing | //! For unit testing | ||||
static std::atomic<int64_t> nMockTime(0); | static std::atomic<int64_t> nMockTime(0); | ||||
int64_t GetTime() { | int64_t GetTime() { | ||||
int64_t mocktime = nMockTime.load(std::memory_order_relaxed); | int64_t mocktime = nMockTime.load(std::memory_order_relaxed); | ||||
if (mocktime) { | if (mocktime) { | ||||
return mocktime; | return mocktime; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines |