Files
bitcoin/src/test/util/time.h
MarcoFalke fa9c38794e test: Introduce MockableSteadyClock::mock_time_point and ElapseSteady helper
This refactor clarifies that the MockableSteadyClock::mock_time_point
has millisecond precision by defining a type an using it.

Moreover, a ElapseSteady helper is added which can be re-used easily.
2025-04-09 20:05:17 +02:00

24 lines
613 B
C++

// Copyright (c) The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_TEST_UTIL_TIME_H
#define BITCOIN_TEST_UTIL_TIME_H
#include <util/time.h>
struct ElapseSteady {
MockableSteadyClock::mock_time_point::duration t{MockableSteadyClock::INITIAL_MOCK_TIME};
ElapseSteady()
{
(*this)(0s); // init
}
void operator()(std::chrono::milliseconds d)
{
t += d;
MockableSteadyClock::SetMockTime(t);
}
};
#endif // BITCOIN_TEST_UTIL_TIME_H