mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 21:12:48 +01:00
Don't scan the time offsets vector repeatedly once we've displayed the warning that the user's clock may be wrong.
This commit is contained in:
parent
10abe4f26e
commit
d9711a5798
11
util.cpp
11
util.cpp
@ -810,13 +810,17 @@ void AddTimeData(unsigned int ip, int64 nTime)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
nTimeOffset = 0;
|
nTimeOffset = 0;
|
||||||
// If nobody else has the same time as us, give a warning
|
|
||||||
|
static bool fDone;
|
||||||
|
if (!fDone)
|
||||||
|
{
|
||||||
|
// If nobody has a time different than ours but within 5 minutes of ours, give a warning
|
||||||
bool fMatch = false;
|
bool fMatch = false;
|
||||||
foreach(int64 nOffset, vTimeOffsets)
|
foreach(int64 nOffset, vTimeOffsets)
|
||||||
if (nOffset != 0 && abs64(nOffset) < 5 * 60)
|
if (nOffset != 0 && abs64(nOffset) < 5 * 60)
|
||||||
fMatch = true;
|
fMatch = true;
|
||||||
static bool fDone;
|
|
||||||
if (!fMatch && !fDone)
|
if (!fMatch)
|
||||||
{
|
{
|
||||||
fDone = true;
|
fDone = true;
|
||||||
string strMessage = _("Warning: Please check that your computer's date and time are correct. If your clock is wrong Bitcoin will not work properly.");
|
string strMessage = _("Warning: Please check that your computer's date and time are correct. If your clock is wrong Bitcoin will not work properly.");
|
||||||
@ -825,6 +829,7 @@ void AddTimeData(unsigned int ip, int64 nTime)
|
|||||||
boost::thread(boost::bind(ThreadSafeMessageBox, strMessage+" ", string("Bitcoin"), wxOK | wxICON_EXCLAMATION, (wxWindow*)NULL, -1, -1));
|
boost::thread(boost::bind(ThreadSafeMessageBox, strMessage+" ", string("Bitcoin"), wxOK | wxICON_EXCLAMATION, (wxWindow*)NULL, -1, -1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
foreach(int64 n, vTimeOffsets)
|
foreach(int64 n, vTimeOffsets)
|
||||||
printf("%+"PRI64d" ", n);
|
printf("%+"PRI64d" ", n);
|
||||||
printf("| nTimeOffset = %+"PRI64d" (%+"PRI64d" minutes)\n", nTimeOffset, nTimeOffset/60);
|
printf("| nTimeOffset = %+"PRI64d" (%+"PRI64d" minutes)\n", nTimeOffset, nTimeOffset/60);
|
||||||
|
Loading…
Reference in New Issue
Block a user