Bitcoin Core  0.20.99
P2P Digital Currency
Macros | Functions | Variables
timedata.cpp File Reference
#include <timedata.h>
#include <netaddress.h>
#include <sync.h>
#include <ui_interface.h>
#include <util/system.h>
#include <util/translation.h>
#include <warnings.h>
Include dependency graph for timedata.cpp:

Go to the source code of this file.

Macros

#define BITCOIN_TIMEDATA_MAX_SAMPLES   200
 

Functions

static int64_t nTimeOffset GUARDED_BY (cs_nTimeOffset)=0
 
int64_t GetTimeOffset ()
 "Never go to sea with two chronometers; take one or three." Our three time sources are: More...
 
int64_t GetAdjustedTime ()
 
static int64_t abs64 (int64_t n)
 
void AddTimeData (const CNetAddr &ip, int64_t nOffsetSample)
 

Variables

static RecursiveMutex cs_nTimeOffset
 

Macro Definition Documentation

◆ BITCOIN_TIMEDATA_MAX_SAMPLES

#define BITCOIN_TIMEDATA_MAX_SAMPLES   200

Definition at line 45 of file timedata.cpp.

Function Documentation

◆ abs64()

static int64_t abs64 ( int64_t  n)
static

Definition at line 40 of file timedata.cpp.

Here is the caller graph for this function:

◆ AddTimeData()

void AddTimeData ( const CNetAddr ip,
int64_t  nOffsetSample 
)

Definition at line 47 of file timedata.cpp.

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

◆ GetAdjustedTime()

int64_t GetAdjustedTime ( )

Definition at line 35 of file timedata.cpp.

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

◆ GetTimeOffset()

int64_t GetTimeOffset ( )

"Never go to sea with two chronometers; take one or three." Our three time sources are:

Functions to keep track of adjusted P2P time.

  • System clock
  • Median of other nodes clocks
  • The user (asking the user to fix the system clock if the first two disagree)

Definition at line 29 of file timedata.cpp.

Here is the caller graph for this function:

◆ GUARDED_BY()

static int64_t nTimeOffset GUARDED_BY ( cs_nTimeOffset  )
staticpure virtual

Variable Documentation

◆ cs_nTimeOffset

RecursiveMutex cs_nTimeOffset
static

Definition at line 19 of file timedata.cpp.