Line data Source code
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 680 : ElapseSteady()
13 680 : {
14 680 : (*this)(0s); // init
15 680 : }
16 680 : void operator()(std::chrono::milliseconds d)
17 : {
18 680 : t += d;
19 680 : MockableSteadyClock::SetMockTime(t);
20 : }
21 : };
22 :
23 : #endif // BITCOIN_TEST_UTIL_TIME_H
|