mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-06 13:47:56 +02:00
test: Fixup docs for NodeClockContext and SteadyClockContext
This commit is contained in:
@@ -42,8 +42,10 @@ struct CheckGlobalsImpl {
|
||||
std::cerr << "\n\n"
|
||||
"The current fuzz target accessed system time.\n\n"
|
||||
|
||||
"This is acceptable, but requires the fuzz target to call \n"
|
||||
"SetMockTime() at the beginning of processing the fuzz input.\n\n"
|
||||
"This is acceptable, but requires the fuzz target to use \n"
|
||||
"a NodeClockContext, SteadyClockContext or call \n"
|
||||
"SetMockTime() at the \n" "beginning of processing the \n"
|
||||
"fuzz input.\n\n"
|
||||
|
||||
"Without setting mock time, time-dependent behavior can lead \n"
|
||||
"to non-reproducible bugs or inefficient fuzzing.\n\n"
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
/** Mockable clock in the context of tests, otherwise the system clock */
|
||||
/// Version of the system clock that is mockable in the context of tests (via
|
||||
/// NodeClockContext or ::SetMockTime), otherwise the system clock.
|
||||
struct NodeClock : public std::chrono::system_clock {
|
||||
using time_point = std::chrono::time_point<NodeClock>;
|
||||
/** Return current system time or mocked time, if set */
|
||||
@@ -31,10 +32,9 @@ using SteadyMicroseconds = std::chrono::time_point<std::chrono::steady_clock, st
|
||||
|
||||
using SystemClock = std::chrono::system_clock;
|
||||
|
||||
/**
|
||||
* Version of SteadyClock that is mockable in the context of tests (set the
|
||||
* current value with SetMockTime), otherwise the system steady clock.
|
||||
*/
|
||||
/// Version of SteadyClock that is mockable in the context of tests (via
|
||||
/// SteadyClockContext, or Self::SetMockTime), otherwise the system steady
|
||||
/// clock.
|
||||
struct MockableSteadyClock : public std::chrono::steady_clock {
|
||||
using time_point = std::chrono::time_point<MockableSteadyClock>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user