diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-09-29 22:37:50 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-09-29 22:37:50 +0200 |
commit | 9c7cfd29ad435d98ab70ad32282b9ec4dac666cd (patch) | |
tree | 3dd3dc565892ffa61253d5a6cbdb5b3273cb5b2e | |
parent | Updated README (diff) | |
download | cuberite-9c7cfd29ad435d98ab70ad32282b9ec4dac666cd.tar cuberite-9c7cfd29ad435d98ab70ad32282b9ec4dac666cd.tar.gz cuberite-9c7cfd29ad435d98ab70ad32282b9ec4dac666cd.tar.bz2 cuberite-9c7cfd29ad435d98ab70ad32282b9ec4dac666cd.tar.lz cuberite-9c7cfd29ad435d98ab70ad32282b9ec4dac666cd.tar.xz cuberite-9c7cfd29ad435d98ab70ad32282b9ec4dac666cd.tar.zst cuberite-9c7cfd29ad435d98ab70ad32282b9ec4dac666cd.zip |
-rw-r--r-- | source/Root.cpp | 22 | ||||
-rw-r--r-- | source/Server.cpp | 4 |
2 files changed, 9 insertions, 17 deletions
diff --git a/source/Root.cpp b/source/Root.cpp index 24ff77e42..c33af52ad 100644 --- a/source/Root.cpp +++ b/source/Root.cpp @@ -17,11 +17,11 @@ #include "Protocol/ProtocolRecognizer.h" // for protocol version constants #include "CommandOutput.h" #include "DeadlockDetect.h" +#include "OSSupport/Timer.h" #include "../iniFile/iniFile.h" #include <iostream> -#include <time.h> @@ -92,16 +92,9 @@ void cRoot::InputThread(void * a_Params) void cRoot::Start(void) { - time_t timer; - struct tm y2k; - double seconds; - double finishseconds; + cTimer Time; - y2k.tm_hour = 0; y2k.tm_min = 0; y2k.tm_sec = 0; - y2k.tm_year = 100; y2k.tm_mon = 0; y2k.tm_mday = 1; - - time(&timer); - seconds = difftime(timer,mktime(&y2k)); + long long mseconds = Time.GetNowTime(); cDeadlockDetect dd; delete m_Log; @@ -188,12 +181,11 @@ void cRoot::Start(void) m_InputThread->Start( false ); // We should NOT wait? Otherwise we canīt stop the server from other threads than the input thread #endif - time(&timer); - finishseconds = difftime(timer,mktime(&y2k)); - finishseconds -= seconds; + long long finishmseconds = Time.GetNowTime(); + finishmseconds -= mseconds; - if ((finishseconds > 1) || (finishseconds == 0)) { LOG("Startup complete, took %.f seconds!", finishseconds); } - else { LOG("Startup complete, took 1 second!"); } + if ((finishmseconds > 1) || (finishmseconds == 0)) { LOG("Startup complete, took %i miliseconds!", finishmseconds); } // Milisecs, why not :P + else { LOG("Startup complete, took 1 milisecond!"); } while (!m_bStop && !m_bRestart) // These are modified by external threads { diff --git a/source/Server.cpp b/source/Server.cpp index 4283dbfae..fec8fcd36 100644 --- a/source/Server.cpp +++ b/source/Server.cpp @@ -206,8 +206,8 @@ bool cServer::InitServer(cIniFile & a_SettingsIni) return false; } - LOGD("Compatible clients: %s", MCS_CLIENT_VERSIONS); - LOGD("Compatible protocol versions %s", MCS_PROTOCOL_VERSIONS); + LOGINFO("Compatible clients: %s", MCS_CLIENT_VERSIONS); + LOGINFO("Compatible protocol versions %s", MCS_PROTOCOL_VERSIONS); if (cSocket::WSAStartup() != 0) // Only does anything on Windows, but whatever { |