File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 16
16
17
17
void UninterruptibleSleep (const std::chrono::microseconds& n) { std::this_thread::sleep_for (n); }
18
18
19
- static std::atomic<int64_t > nMockTime ( 0 ) ; // !< For testing
19
+ static std::atomic<std::chrono::seconds> g_mock_time{} ; // !< For testing
20
20
21
21
NodeClock::time_point NodeClock::now () noexcept
22
22
{
23
- const std::chrono::seconds mocktime{nMockTime .load (std::memory_order_relaxed)};
23
+ const auto mocktime{g_mock_time .load (std::memory_order_relaxed)};
24
24
const auto ret{
25
25
mocktime.count () ?
26
26
mocktime :
@@ -33,12 +33,12 @@ void SetMockTime(int64_t nMockTimeIn) { SetMockTime(std::chrono::seconds{nMockTi
33
33
void SetMockTime (std::chrono::seconds mock_time_in)
34
34
{
35
35
Assert (mock_time_in >= 0s);
36
- nMockTime .store (mock_time_in. count () , std::memory_order_relaxed);
36
+ g_mock_time .store (mock_time_in, std::memory_order_relaxed);
37
37
}
38
38
39
39
std::chrono::seconds GetMockTime ()
40
40
{
41
- return std::chrono::seconds (nMockTime .load (std::memory_order_relaxed) );
41
+ return g_mock_time .load (std::memory_order_relaxed);
42
42
}
43
43
44
44
int64_t GetTime () { return GetTime<std::chrono::seconds>().count (); }
You can’t perform that action at this time.
0 commit comments