5#if defined(HAVE_CONFIG_H)
6#include <config/bitcoin-config.h>
39#define BITCOIN_TIMEDATA_MAX_SAMPLES 200
58 "added time data, samples %d, offset %+d (%+d minutes)\n",
104 strprintf(
_(
"Please check that your computer's date "
105 "and time are correct! If your clock is "
106 "wrong, %s will not work properly."),
116 for (
const int64_t n : vSorted) {
122 nTimeOffset, nTimeOffset / 60);
int64_t GetIntArg(const std::string &strArg, int64_t nDefault) const
Return integer argument or default value.
Different type to mark Mutex at global scope.
#define LogPrint(category,...)
#define LogPrintToBeContinued
static bool LogAcceptCategory(BCLog::LogFlags category, BCLog::Level level)
Return true if log accepts specified category, at the specified level.
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
static time_point now() noexcept
Return current system time or mocked time, if set.
std::chrono::time_point< NodeClock > time_point
int64_t GetTimeOffset()
"Never go to sea with two chronometers; take one or three." Our three time sources are:
void TestOnlyResetTimeData()
Reset the internal state of GetTimeOffset(), GetAdjustedTime() and AddTimeData().
static GlobalMutex g_timeoffset_mutex
#define BITCOIN_TIMEDATA_MAX_SAMPLES
NodeClock::time_point GetAdjustedTime()
static std::set< CNetAddr > g_sources
void AddTimeData(const CNetAddr &ip, int64_t nOffsetSample)
static CMedianFilter< int64_t > g_time_offsets(BITCOIN_TIMEDATA_MAX_SAMPLES, 0)
static bool g_warning_emitted
static const int64_t DEFAULT_MAX_TIME_ADJUSTMENT
bilingual_str _(const char *psz)
Translation function.
CClientUIInterface uiInterface
void SetMiscWarning(const bilingual_str &warning)