From 02c9c3dc349c7de586fba135a418ac28060e30a8 Mon Sep 17 00:00:00 2001 From: svost Date: Tue, 15 Feb 2022 17:23:15 +0300 Subject: [PATCH] Remove abs64 inline --- src/ntp.cpp | 7 +++---- src/util.h | 5 ----- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/ntp.cpp b/src/ntp.cpp index 6cf038c..4dfcb7c 100644 --- a/src/ntp.cpp +++ b/src/ntp.cpp @@ -13,7 +13,6 @@ #include "netbase.h" #include "net.h" -//#include "util.h" #include "interface.h" extern int GetRandInt(int nMax); @@ -462,7 +461,7 @@ void ThreadNtpSamples(void* parg) { // Trying to get new offset sample from trusted NTP server. int64_t nClockOffset = NtpGetTime(strTrustedUpstream) - GetTime(); - if (abs64(nClockOffset) < nMaxOffset) { + if (abs(nClockOffset) < nMaxOffset) { // Everything seems right, remember new trusted offset. printf("ThreadNtpSamples: new offset sample from %s, offset=%" PRId64 ".\n", strTrustedUpstream.c_str(), nClockOffset); nNtpOffset = nClockOffset; @@ -487,7 +486,7 @@ void ThreadNtpSamples(void* parg) { CNetAddr ip; int64_t nClockOffset = NtpGetTime(ip) - GetTime(); - if (abs64(nClockOffset) < nMaxOffset) { // Skip the deliberately wrong timestamps + if (abs(nClockOffset) < nMaxOffset) { // Skip the deliberately wrong timestamps printf("ThreadNtpSamples: new offset sample from %s, offset=%" PRId64 ".\n", ip.ToString().c_str(), nClockOffset); vTimeOffsets.input(nClockOffset); } @@ -506,7 +505,7 @@ void ThreadNtpSamples(void* parg) { } } - if (GetNodesOffset() == INT_MAX && abs64(nNtpOffset) > 40 * 60) + if (GetNodesOffset() == INT_MAX && abs(nNtpOffset) > 40 * 60) { // If there is not enough node offsets data and NTP time offset is greater than 40 minutes then give a warning. std::string strMessage = _("Warning: Please check that your computer's date and time are correct! If your clock is wrong NovaCoin will not work properly."); diff --git a/src/util.h b/src/util.h index 3138b7c..8a69fc1 100644 --- a/src/util.h +++ b/src/util.h @@ -295,11 +295,6 @@ inline int64_t roundint64(double d) return (int64_t)(d > 0 ? d + 0.5 : d - 0.5); } -inline int64_t abs64(int64_t n) -{ - return (n >= 0 ? n : -n); -} - inline std::string leftTrim(std::string src, char chr) { std::string::size_type pos = src.find_first_not_of(chr, 0); -- 1.7.1