 |
PRCYCoin
2.0.0.7rc1
P2P Digital Currency
|
Go to the documentation of this file.
15 static int64_t nTimeOffset = 0;
35 static int64_t abs64(int64_t n)
37 return (n >= 0 ? n : -n);
44 static std::set<CNetAddr> setKnown;
45 if (!setKnown.insert(ip).second)
50 vTimeOffsets.
input(nOffsetSample);
51 LogPrintf(
"Added time data, samples %d, offset %+d (%+d minutes)\n", vTimeOffsets.
size(), nOffsetSample, nOffsetSample / 60);
70 if (vTimeOffsets.
size() >= 5 && vTimeOffsets.
size() % 2 == 1) {
71 int64_t nMedian = vTimeOffsets.
median();
72 std::vector<int64_t> vSorted = vTimeOffsets.
sorted();
74 if (abs64(nMedian) < 70 * 60) {
75 nTimeOffset = nMedian;
83 for (int64_t nOffset : vSorted)
84 if (nOffset != 0 && abs64(nOffset) < 5 * 60)
89 std::string strMessage =
_(
"Warning: Please check that your computer's date and time are correct! If your clock is wrong PRCY will not work properly.");
97 for (int64_t n : vSorted)
101 LogPrintf(
"nTimeOffset = %+d (%+d minutes)\n", nTimeOffset, nTimeOffset / 60);
int64_t GetTime()
For unit testing.
CClientUIInterface uiInterface
IP address (IPv6, or IPv4 using mapped IPv6 range (::FFFF:0:0/96))
BCLog::Logger *const g_logger
NOTE: the logger instances is leaked on exit.
std::string strMiscWarning
std::string _(const char *psz)
Translation function: Call Translate signal on UI interface, which returns a boost::optional result.
boost::signals2::signal< bool(const std::string &message, const std::string &caption, unsigned int style), boost::signals2::last_value< bool > > ThreadSafeMessageBox
Show message box.
bool GetBoolArg(const std::string &strArg, bool fDefault)
Return boolean argument or default value.
void AddTimeData(const CNetAddr &ip, int64_t nOffsetSample)
int64_t GetAdjustedTime()
bool DefaultShrinkDebugFile() const
int64_t GetTimeOffset()
"Never go to sea with two chronometers; take one or three." Our three time sources are: