Added GetArgInt function
[novacoin.git] / src / init.cpp
index 9655f2a..76f28e8 100644 (file)
@@ -8,7 +8,6 @@
 #include "net.h"
 #include "init.h"
 #include "util.h"
-#include "ntp.h"
 #include "ui_interface.h"
 #include "checkpoints.h"
 #include <boost/format.hpp>
@@ -446,7 +445,7 @@ bool AppInit2()
     // ********************************************************* Step 3: parameter-to-internal-flags
 
     // -par=0 means autodetect, but nScriptCheckThreads==0 means no concurrency
-    nScriptCheckThreads = (int)(GetArg("-par", 0));
+    nScriptCheckThreads = GetArgInt("-par", 0);
     if (nScriptCheckThreads == 0)
         nScriptCheckThreads = boost::thread::hardware_concurrency();
     if (nScriptCheckThreads <= 1) 
@@ -485,7 +484,7 @@ bool AppInit2()
 
     if (mapArgs.count("-timeout"))
     {
-        int nNewTimeout = (int)(GetArg("-timeout", 5000));
+        int nNewTimeout = GetArgInt("-timeout", 5000);
         if (nNewTimeout > 0 && nNewTimeout < 600000)
             nConnectTimeout = nNewTimeout;
     }
@@ -606,7 +605,7 @@ bool AppInit2()
 
     // ********************************************************* Step 6: network initialization
 
-    int nSocksVersion = (int)(GetArg("-socks", 5));
+    int nSocksVersion = GetArgInt("-socks", 5);
 
     if (nSocksVersion != 4 && nSocksVersion != 5)
         return InitError(strprintf(_("Unknown -socks proxy version requested: %i"), nSocksVersion));
@@ -883,7 +882,7 @@ bool AppInit2()
 
     if (GetBoolArg("-upgradewallet", fFirstRun))
     {
-        int nMaxVersion = (int)(GetArg("-upgradewallet", 0));
+        int nMaxVersion = GetArgInt("-upgradewallet", 0);
         if (nMaxVersion == 0) // the -upgradewallet without argument case
         {
             printf("Performing wallet upgrade to %i\n", FEATURE_LATEST);
@@ -996,33 +995,6 @@ bool AppInit2()
     if (fServer)
         NewThread(ThreadRPCServer, NULL);
 
-    // ********************************************************* Step 12: NTP synchronization
-
-    // First, do a simple check whether there is a local ntp server.
-    string strLocalHost = "127.0.0.1";
-    int64_t nTime = NtpGetTime(strLocalHost);
-
-    if (nTime < 0 || nTime != GetTime()) {
-        // If not, then request current timestamp from three random NTP servers.
-        uiInterface.InitMessage(_("Synchronizing time through NTP..."));
-        printf("Synchronizing time through NTP...\n");
-
-        for(int i = 0; i < 2; i++) {
-            CNetAddr ip;
-            int64_t nTime = NtpGetTime(ip);
-
-            if (nTime > 0 && nTime != 2085978496) { // Skip the deliberately wrong timestamps
-                AddTimeData(ip, nTime);
-                printf("AddTimeData(%s, %" PRId64 ")\n", ip.ToString().c_str(), nTime);
-            }
-        }
-
-        // When done, start a periodical sampling thread
-        NewThread(ThreadNtpSamples, NULL);
-
-        uiInterface.InitMessage(_("Done"));
-        printf("Done\n");
-    }
     // ********************************************************* Step 12: finished
 
     uiInterface.InitMessage(_("Done loading"));