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