| 18 | static std::atomic<int64_t> nMockTime(0); //!< For unit testing |
| 19 | |
| 20 | int64_t GetTime() |
| 21 | { |
| 22 | int64_t mocktime = nMockTime.load(std::memory_order_relaxed); |
| 23 | if (mocktime) return mocktime; |
| 24 | |
| 25 | time_t now = time(nullptr); |
| 26 | assert(now > 0); |
| 27 | return now; |
| 28 | } |
| 29 | |
| 30 | void SetMockTime(int64_t nMockTimeIn) |
| 31 | { |
no outgoing calls