Skip to content

Commit cc5c0d2

Browse files
committed
refactor: Fix formatting of timedata.cpp
1 parent c2410ce commit cc5c0d2

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

src/timedata.cpp

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <util/translation.h>
1616
#include <warnings.h>
1717

18-
1918
static Mutex g_timeoffset_mutex;
2019
static int64_t nTimeOffset GUARDED_BY(g_timeoffset_mutex) = 0;
2120

@@ -57,7 +56,7 @@ void AddTimeData(const CNetAddr& ip, int64_t nOffsetSample)
5756
// Add data
5857
static CMedianFilter<int64_t> vTimeOffsets(BITCOIN_TIMEDATA_MAX_SAMPLES, 0);
5958
vTimeOffsets.input(nOffsetSample);
60-
LogPrint(BCLog::NET,"added time data, samples %d, offset %+d (%+d minutes)\n", vTimeOffsets.size(), nOffsetSample, nOffsetSample/60);
59+
LogPrint(BCLog::NET, "added time data, samples %d, offset %+d (%+d minutes)\n", vTimeOffsets.size(), nOffsetSample, nOffsetSample / 60);
6160

6261
// There is a known issue here (see issue #4521):
6362
//
@@ -76,30 +75,24 @@ void AddTimeData(const CNetAddr& ip, int64_t nOffsetSample)
7675
// So we should hold off on fixing this and clean it up as part of
7776
// a timing cleanup that strengthens it in a number of other ways.
7877
//
79-
if (vTimeOffsets.size() >= 5 && vTimeOffsets.size() % 2 == 1)
80-
{
78+
if (vTimeOffsets.size() >= 5 && vTimeOffsets.size() % 2 == 1) {
8179
int64_t nMedian = vTimeOffsets.median();
8280
std::vector<int64_t> vSorted = vTimeOffsets.sorted();
8381
// Only let other nodes change our time by so much
84-
if (abs64(nMedian) <= std::max<int64_t>(0, gArgs.GetArg("-maxtimeadjustment", DEFAULT_MAX_TIME_ADJUSTMENT)))
85-
{
82+
if (abs64(nMedian) <= std::max<int64_t>(0, gArgs.GetArg("-maxtimeadjustment", DEFAULT_MAX_TIME_ADJUSTMENT))) {
8683
nTimeOffset = nMedian;
87-
}
88-
else
89-
{
84+
} else {
9085
nTimeOffset = 0;
9186

9287
static bool fDone;
93-
if (!fDone)
94-
{
88+
if (!fDone) {
9589
// If nobody has a time different than ours but within 5 minutes of ours, give a warning
9690
bool fMatch = false;
97-
for (const int64_t nOffset : vSorted)
98-
if (nOffset != 0 && abs64(nOffset) < 5 * 60)
99-
fMatch = true;
91+
for (const int64_t nOffset : vSorted) {
92+
if (nOffset != 0 && abs64(nOffset) < 5 * 60) fMatch = true;
93+
}
10094

101-
if (!fMatch)
102-
{
95+
if (!fMatch) {
10396
fDone = true;
10497
bilingual_str strMessage = strprintf(_("Please check that your computer's date and time are correct! If your clock is wrong, %s will not work properly."), PACKAGE_NAME);
10598
SetMiscWarning(strMessage.translated);
@@ -113,8 +106,7 @@ void AddTimeData(const CNetAddr& ip, int64_t nOffsetSample)
113106
LogPrint(BCLog::NET, "%+d ", n); /* Continued */
114107
}
115108
LogPrint(BCLog::NET, "| "); /* Continued */
116-
117-
LogPrint(BCLog::NET, "nTimeOffset = %+d (%+d minutes)\n", nTimeOffset, nTimeOffset/60);
109+
LogPrint(BCLog::NET, "nTimeOffset = %+d (%+d minutes)\n", nTimeOffset, nTimeOffset / 60);
118110
}
119111
}
120112
}

0 commit comments

Comments
 (0)