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

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

#include <time.h>

Public Member Functions

 NodeClockContext (NodeSeconds init_time)
 Initialize with the given time. More...
 
 NodeClockContext (std::chrono::seconds init_time)
 
 NodeClockContext ()
 Initialize with current time, using the next tick to avoid going back by rounding to seconds. More...
 
 ~NodeClockContext ()
 Unset mocktime. More...
 
 NodeClockContext (const NodeClockContext &)=delete
 
NodeClockContextoperator= (const NodeClockContext &)=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)
 

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 39 of file time.h.

Constructor & Destructor Documentation

◆ NodeClockContext() [1/4]

NodeClockContext::NodeClockContext ( NodeSeconds  init_time)
inlineexplicit

Initialize with the given time.

Definition at line 45 of file time.h.

Here is the call graph for this function:

◆ NodeClockContext() [2/4]

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

Definition at line 46 of file time.h.

Here is the call graph for this function:

◆ NodeClockContext() [3/4]

NodeClockContext::NodeClockContext ( )
inlineexplicit

Initialize with current time, using the next tick to avoid going back by rounding to seconds.

Definition at line 48 of file time.h.

Here is the call graph for this function:

◆ ~NodeClockContext()

NodeClockContext::~NodeClockContext ( )
inline

Unset mocktime.

Definition at line 51 of file time.h.

Here is the call graph for this function:

◆ NodeClockContext() [4/4]

NodeClockContext::NodeClockContext ( const NodeClockContext )
delete

Member Function Documentation

◆ operator+=()

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

Change mocktime by the given duration delta.

Definition at line 61 of file time.h.

Here is the call graph for this function:

◆ operator-=()

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

Definition at line 62 of file time.h.

Here is the call graph for this function:

◆ operator=()

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

◆ set() [1/2]

void NodeClockContext::set ( NodeSeconds  t)
inline

Set mocktime.

Definition at line 57 of file time.h.

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

◆ set() [2/2]

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

Definition at line 58 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 NodeClockContext::m_t {std::chrono::seconds::max()}
private

Definition at line 41 of file time.h.


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