From 665cc138415d03c0cfa90ff4c575da058dafb3cb Mon Sep 17 00:00:00 2001 From: svost Date: Mon, 3 Oct 2016 16:17:08 +0300 Subject: [PATCH] Wip: deal with namespace in h and cpp files --- src/ntp.cpp | 18 ++++++++++-------- 1 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/ntp.cpp b/src/ntp.cpp index b9a524c..26450a1 100644 --- a/src/ntp.cpp +++ b/src/ntp.cpp @@ -6,6 +6,8 @@ #include "net.h" #include "ui_interface.h" +using namespace std; + extern int GetRandInt(int nMax); /* @@ -72,7 +74,7 @@ struct pkt { const int nServersCount = 162; -std::string NtpServers[162] = { +string NtpServers[162] = { // Microsoft "time.windows.com", @@ -270,11 +272,11 @@ std::string NtpServers[162] = { // ... To be continued }; -bool InitWithHost(const std::string &strHostName, SOCKET &sockfd, socklen_t &servlen, struct sockaddr *pcliaddr) { +bool InitWithHost(const string &strHostName, SOCKET &sockfd, socklen_t &servlen, struct sockaddr *pcliaddr) { sockfd = INVALID_SOCKET; - std::vector vIP; + vector vIP; bool fRet = LookupHost(strHostName, vIP, 10, true); if (!fRet) { return false; @@ -390,7 +392,7 @@ int64_t NtpGetTime(CNetAddr& ip) { return nTime; } -int64_t NtpGetTime(const std::string &strHostName) +int64_t NtpGetTime(const string &strHostName) { struct sockaddr cliaddr; @@ -409,7 +411,7 @@ int64_t NtpGetTime(const std::string &strHostName) // NTP server, which we unconditionally trust. This may be your own installation of ntpd somewhere, for example. // "localhost" means "trust no one" -std::string strTrustedUpstream = "localhost"; +string strTrustedUpstream = "localhost"; // Current offset int64_t nNtpOffset = numeric_limits::max(); @@ -423,7 +425,7 @@ void ThreadNtpSamples(void* parg) { printf("Trying to find NTP server at localhost...\n"); - std::string strLocalHost = "127.0.0.1"; + string strLocalHost = "127.0.0.1"; if (NtpGetTime(strLocalHost) == GetTime()) { printf("There is NTP server active at localhost, we don't need NTP thread.\n"); @@ -491,10 +493,10 @@ void ThreadNtpSamples(void* parg) { if (GetNodesOffset() == numeric_limits::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."); + string strMessage = _("Warning: Please check that your computer's date and time are correct! If your clock is wrong NovaCoin will not work properly."); strMiscWarning = strMessage; printf("*** %s\n", strMessage.c_str()); - uiInterface.ThreadSafeMessageBox(strMessage+" ", std::string("NovaCoin"), CClientUIInterface::OK | CClientUIInterface::ICON_EXCLAMATION); + uiInterface.ThreadSafeMessageBox(strMessage+" ", string("NovaCoin"), CClientUIInterface::OK | CClientUIInterface::ICON_EXCLAMATION); } printf("nNtpOffset = %+" PRId64 " (%+" PRId64 " minutes)\n", nNtpOffset, nNtpOffset/60); -- 1.7.1