Changeset View
Changeset View
Standalone View
Standalone View
src/util/time.cpp
Show All 38 Lines | return std::chrono::duration_cast<T>( | ||||
mocktime.count() ? mocktime | mocktime.count() ? mocktime | ||||
: std::chrono::microseconds{GetTimeMicros()}); | : std::chrono::microseconds{GetTimeMicros()}); | ||||
} | } | ||||
template std::chrono::seconds GetTime(); | template std::chrono::seconds GetTime(); | ||||
template std::chrono::milliseconds GetTime(); | template std::chrono::milliseconds GetTime(); | ||||
template std::chrono::microseconds GetTime(); | template std::chrono::microseconds GetTime(); | ||||
void SetMockTime(int64_t nMockTimeIn) { | void SetMockTime(int64_t nMockTimeIn) { | ||||
assert(nMockTimeIn >= 0); | |||||
nMockTime.store(nMockTimeIn, std::memory_order_relaxed); | nMockTime.store(nMockTimeIn, std::memory_order_relaxed); | ||||
} | } | ||||
int64_t GetMockTime() { | int64_t GetMockTime() { | ||||
return nMockTime.load(std::memory_order_relaxed); | return nMockTime.load(std::memory_order_relaxed); | ||||
} | } | ||||
int64_t GetTimeMillis() { | int64_t GetTimeMillis() { | ||||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |