/root/bitcoin/src/test/util/time.h
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright (c) The Bitcoin Core developers |
2 | | // Distributed under the MIT software license, see the accompanying |
3 | | // file COPYING or http://www.opensource.org/licenses/mit-license.php. |
4 | | |
5 | | #ifndef BITCOIN_TEST_UTIL_TIME_H |
6 | | #define BITCOIN_TEST_UTIL_TIME_H |
7 | | |
8 | | #include <util/time.h> |
9 | | |
10 | | struct ElapseSteady { |
11 | | MockableSteadyClock::mock_time_point::duration t{MockableSteadyClock::INITIAL_MOCK_TIME}; |
12 | | ElapseSteady() |
13 | 0 | { |
14 | 0 | (*this)(0s); // init |
15 | 0 | } |
16 | | void operator()(std::chrono::milliseconds d) |
17 | 0 | { |
18 | 0 | t += d; |
19 | 0 | MockableSteadyClock::SetMockTime(t); |
20 | 0 | } |
21 | | }; |
22 | | |
23 | | #endif // BITCOIN_TEST_UTIL_TIME_H |