Bitcoin Core 31.99.0
P2P Digital Currency
Public Member Functions | Private Attributes | List of all members
FakeNodeClock Class Reference

Helper to initialize the global NodeClock, let a duration elapse, and reset it after use in a test. More...

#include <time.h>

Inheritance diagram for FakeNodeClock:
[legend]
Collaboration diagram for FakeNodeClock:
[legend]

Public Member Functions

 FakeNodeClock (NodeSeconds init_time)
 Initialize with the given time. More...
 
 FakeNodeClock (std::chrono::seconds init_time)
 
 FakeNodeClock ()
 Initialize with current time. More...
 
 ~FakeNodeClock ()
 Unset mocktime. More...
 
 FakeNodeClock (const FakeNodeClock &)=delete
 
FakeNodeClockoperator= (const FakeNodeClock &)=delete
 
void set (NodeSeconds t)
 Set mocktime. More...
 
void set (std::chrono::seconds t)
 
void operator+= (std::chrono::seconds d)
 Change mocktime by the given duration delta. More...
 
void operator-= (std::chrono::seconds d)
 
- Public Member Functions inherited from LimitOne< FakeNodeClock >
 LimitOne ()
 
 LimitOne (const LimitOne &)=delete
 
 ~LimitOne ()
 
LimitOneoperator= (const LimitOne &)=delete
 

Private Attributes

NodeSeconds m_t {std::chrono::seconds::max()}
 

Detailed Description

Helper to initialize the global NodeClock, let a duration elapse, and reset it after use in a test.

Definition at line 53 of file time.h.

Constructor & Destructor Documentation

◆ FakeNodeClock() [1/4]

FakeNodeClock::FakeNodeClock ( NodeSeconds  init_time)
inlineexplicit

Initialize with the given time.

Definition at line 59 of file time.h.

Here is the call graph for this function:

◆ FakeNodeClock() [2/4]

FakeNodeClock::FakeNodeClock ( std::chrono::seconds  init_time)
inlineexplicit

Definition at line 60 of file time.h.

Here is the call graph for this function:

◆ FakeNodeClock() [3/4]

FakeNodeClock::FakeNodeClock ( )
inlineexplicit

Initialize with current time.

Definition at line 62 of file time.h.

Here is the call graph for this function:

◆ ~FakeNodeClock()

FakeNodeClock::~FakeNodeClock ( )
inline

Unset mocktime.

Definition at line 65 of file time.h.

Here is the call graph for this function:

◆ FakeNodeClock() [4/4]

FakeNodeClock::FakeNodeClock ( const FakeNodeClock )
delete

Member Function Documentation

◆ operator+=()

void FakeNodeClock::operator+= ( std::chrono::seconds  d)
inline

Change mocktime by the given duration delta.

Definition at line 75 of file time.h.

Here is the call graph for this function:

◆ operator-=()

void FakeNodeClock::operator-= ( std::chrono::seconds  d)
inline

Definition at line 76 of file time.h.

Here is the call graph for this function:

◆ operator=()

FakeNodeClock & FakeNodeClock::operator= ( const FakeNodeClock )
delete

◆ set() [1/2]

void FakeNodeClock::set ( NodeSeconds  t)
inline

Set mocktime.

Definition at line 71 of file time.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set() [2/2]

void FakeNodeClock::set ( std::chrono::seconds  t)
inline

Definition at line 72 of file time.h.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_t

NodeSeconds FakeNodeClock::m_t {std::chrono::seconds::max()}
private

Definition at line 55 of file time.h.


The documentation for this class was generated from the following file: