5 #if defined(HAVE_CONFIG_H) 41 #define BITCOIN_TIMEDATA_MAX_SAMPLES 200 82 if (nMedian >= -max_adjustment && nMedian <= max_adjustment) {
83 nTimeOffset = nMedian;
90 for (
const int64_t nOffset : vSorted) {
91 if (nOffset != 0 && nOffset > -5 * 60 && nOffset < 5 * 60) fMatch =
true;
104 std::string log_message{
"time data samples: "};
105 for (
const int64_t n : vSorted) {
108 log_message +=
strprintf(
"| median offset = %+d (%+d minutes)", nTimeOffset, nTimeOffset / 60);
std::chrono::time_point< NodeClock > time_point
static GlobalMutex g_timeoffset_mutex
CClientUIInterface uiInterface
#define LogPrint(category,...)
#define BITCOIN_TIMEDATA_MAX_SAMPLES
void SetMiscWarning(const bilingual_str &warning)
void TestOnlyResetTimeData()
Reset the internal state of GetTimeOffset(), GetAdjustedTime() and AddTimeData(). ...
int64_t GetTimeOffset()
"Never go to sea with two chronometers; take one or three." Our three time sources are: ...
NodeClock::time_point GetAdjustedTime()
static int64_t nTimeOffset GUARDED_BY(g_timeoffset_mutex)=0
bilingual_str _(const char *psz)
Translation function.
static CService ip(uint32_t i)
static std::set< CNetAddr > g_sources
static time_point now() noexcept
Return current system time or mocked time, if set.
int64_t GetIntArg(const std::string &strArg, int64_t nDefault) const
Return integer argument or default value.
static bool LogAcceptCategory(BCLog::LogFlags category, BCLog::Level level)
Return true if log accepts specified category, at the specified level.
Different type to mark Mutex at global scope.
void AddTimeData(const CNetAddr &ip, int64_t nOffsetSample)
static const int64_t DEFAULT_MAX_TIME_ADJUSTMENT
static bool g_warning_emitted
static CMedianFilter< int64_t > g_time_offsets