Bitcoin
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 <warnings.h>

Macros

#define BITCOIN_TIMEDATA_MAX_SAMPLES   200
 

Functions

static int64_t nTimeOffset GUARDED_BY (cs_nTimeOffset)=0
 
int64_t GetTimeOffset ()
 
int64_t GetAdjustedTime ()
 
static int64_t abs64 (int64_t n)
 
void AddTimeData (const CNetAddr &ip, int64_t nOffsetSample)
 

Variables

static CCriticalSection cs_nTimeOffset
 

Macro Definition Documentation

◆ BITCOIN_TIMEDATA_MAX_SAMPLES

#define BITCOIN_TIMEDATA_MAX_SAMPLES   200

Function Documentation

◆ abs64()

static int64_t abs64 ( int64_t  n)
static

◆ AddTimeData()

void AddTimeData ( const CNetAddr ip,
int64_t  nOffsetSample 
)

◆ GetAdjustedTime()

int64_t GetAdjustedTime ( )

◆ GetTimeOffset()

int64_t GetTimeOffset ( )

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

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

◆ GUARDED_BY()

static int64_t nTimeOffset GUARDED_BY ( cs_nTimeOffset  )
staticpure virtual

Variable Documentation

◆ cs_nTimeOffset

CCriticalSection cs_nTimeOffset
static