aboutsummaryrefslogtreecommitdiff
path: root/util.cpp
diff options
context:
space:
mode:
authorChris Moore <dooglus@gmail.com>2011-01-24 16:25:41 -0800
committerChris Moore <dooglus@gmail.com>2011-01-24 16:25:41 -0800
commitd9711a5798709f679521e701034f3ec47d7941c4 (patch)
treef955b7523c98b8abd6c99b43f2f1c3696c7bf553 /util.cpp
parent10abe4f26e83ddc56a984a5be2b901e206ada75d (diff)
Don't scan the time offsets vector repeatedly once we've displayed the warning that the user's clock may be wrong.
Diffstat (limited to 'util.cpp')
-rw-r--r--util.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/util.cpp b/util.cpp
index 0ad9532d65..94b0242dc7 100644
--- a/util.cpp
+++ b/util.cpp
@@ -810,19 +810,24 @@ void AddTimeData(unsigned int ip, int64 nTime)
else
{
nTimeOffset = 0;
- // If nobody else has the same time as us, give a warning
- bool fMatch = false;
- foreach(int64 nOffset, vTimeOffsets)
- if (nOffset != 0 && abs64(nOffset) < 5 * 60)
- fMatch = true;
+
static bool fDone;
- if (!fMatch && !fDone)
+ if (!fDone)
{
- 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.");
- strMiscWarning = strMessage;
- printf("*** %s\n", strMessage.c_str());
- boost::thread(boost::bind(ThreadSafeMessageBox, strMessage+" ", string("Bitcoin"), wxOK | wxICON_EXCLAMATION, (wxWindow*)NULL, -1, -1));
+ // If nobody has a time different than ours but within 5 minutes of ours, give a warning
+ bool fMatch = false;
+ foreach(int64 nOffset, vTimeOffsets)
+ if (nOffset != 0 && abs64(nOffset) < 5 * 60)
+ fMatch = true;
+
+ if (!fMatch)
+ {
+ 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.");
+ strMiscWarning = strMessage;
+ printf("*** %s\n", strMessage.c_str());
+ boost::thread(boost::bind(ThreadSafeMessageBox, strMessage+" ", string("Bitcoin"), wxOK | wxICON_EXCLAMATION, (wxWindow*)NULL, -1, -1));
+ }
}
}
foreach(int64 n, vTimeOffsets)