Remove abs64 inline
authorsvost <ya.nowa@yandex.ru>
Tue, 15 Feb 2022 14:23:15 +0000 (17:23 +0300)
committersvost <ya.nowa@yandex.ru>
Tue, 15 Feb 2022 14:23:15 +0000 (17:23 +0300)
src/ntp.cpp
src/util.h

index 6cf038c..4dfcb7c 100644 (file)
@@ -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.");
index 3138b7c..8a69fc1 100644 (file)
@@ -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);