X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Futil.cpp;h=2f28b95b8e2b64ecc5e2dc7b6f3a7ed37bef4c42;hb=09effd299a712bf55c5ffca932e95a245e2e736c;hp=63c684bb0b28c52856fbd93351da0dedcf952370;hpb=b60dd5749ca05390bceaf3256efc2a036a91f2e8;p=novacoin.git diff --git a/src/util.cpp b/src/util.cpp index 63c684b..2f28b95 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1272,7 +1272,7 @@ void ShrinkDebugFile() // Restart the file with some of the end char pch[200000]; fseek(file, -((long long)sizeof(pch)), SEEK_END); - int nBytes = fread(pch, 1, sizeof(pch), file); + size_t nBytes = fread(pch, 1, sizeof(pch), file); fclose(file); file = fopen(pathLog.string().c_str(), "w"); @@ -1312,20 +1312,24 @@ extern int64_t nNtpOffset; static int64_t nNodesOffset = INT64_MAX; // Select time offset: -// -// * If NTP and system clock are in agreement within 40 minutes, then use NTP. -// * If not, then choose between median peer time and system clock using the same condition. int64_t GetTimeOffset() { + // If NTP and system clock are in agreement within 40 minutes, then use NTP. if (abs64(nNtpOffset) < 40 * 60) return nNtpOffset; - if (abs64(nNodesOffset) < 40 * 60) + // If not, then choose between median peer time and system clock. + if (abs64(nNodesOffset) < 70 * 60) return nNodesOffset; return 0; } +int64_t GetNodesOffset() +{ + return nNodesOffset; +} + int64_t GetAdjustedTime() { return GetTime() + GetTimeOffset();