5 #if defined(HAVE_CONFIG_H)
36 #define BITCOIN_TIMEDATA_MAX_SAMPLES 200
77 if (nMedian >= -max_adjustment && nMedian <= max_adjustment) {
78 nTimeOffset = nMedian;
85 for (
const int64_t nOffset : vSorted) {
86 if (nOffset != 0 && nOffset > -5 * 60 && nOffset < 5 * 60) fMatch =
true;
99 std::string log_message{
"time data samples: "};
100 for (
const int64_t n : vSorted) {
103 log_message +=
strprintf(
"| median offset = %+d (%+d minutes)", 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.
static CService ip(uint32_t i)
CClientUIInterface uiInterface
#define LogPrint(category,...)
static bool LogAcceptCategory(BCLog::LogFlags category, BCLog::Level level)
Return true if log accepts specified category, at the specified level.
static CMedianFilter< int64_t > g_time_offsets
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() and AddTimeData().
static GlobalMutex g_timeoffset_mutex
#define BITCOIN_TIMEDATA_MAX_SAMPLES
static std::set< CNetAddr > g_sources
void AddTimeData(const CNetAddr &ip, int64_t nOffsetSample)
static int64_t nTimeOffset GUARDED_BY(g_timeoffset_mutex)=0
static bool g_warning_emitted
static const int64_t DEFAULT_MAX_TIME_ADJUSTMENT
bilingual_str _(const char *psz)
Translation function.
void SetMiscWarning(const bilingual_str &warning)