1
0

Improvements to startup timer

As suggested by xoft. Also reverted changes of displayed protocol
version.
This commit is contained in:
Tiger Wang 2013-09-29 21:37:50 +01:00
parent ebae946f1c
commit 9c7cfd29ad
2 changed files with 9 additions and 17 deletions

View File

@ -17,11 +17,11 @@
#include "Protocol/ProtocolRecognizer.h" // for protocol version constants #include "Protocol/ProtocolRecognizer.h" // for protocol version constants
#include "CommandOutput.h" #include "CommandOutput.h"
#include "DeadlockDetect.h" #include "DeadlockDetect.h"
#include "OSSupport/Timer.h"
#include "../iniFile/iniFile.h" #include "../iniFile/iniFile.h"
#include <iostream> #include <iostream>
#include <time.h>
@ -92,16 +92,9 @@ void cRoot::InputThread(void * a_Params)
void cRoot::Start(void) void cRoot::Start(void)
{ {
time_t timer; cTimer Time;
struct tm y2k;
double seconds;
double finishseconds;
y2k.tm_hour = 0; y2k.tm_min = 0; y2k.tm_sec = 0; long long mseconds = Time.GetNowTime();
y2k.tm_year = 100; y2k.tm_mon = 0; y2k.tm_mday = 1;
time(&timer);
seconds = difftime(timer,mktime(&y2k));
cDeadlockDetect dd; cDeadlockDetect dd;
delete m_Log; 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 m_InputThread->Start( false ); // We should NOT wait? Otherwise we can´t stop the server from other threads than the input thread
#endif #endif
time(&timer); long long finishmseconds = Time.GetNowTime();
finishseconds = difftime(timer,mktime(&y2k)); finishmseconds -= mseconds;
finishseconds -= seconds;
if ((finishseconds > 1) || (finishseconds == 0)) { LOG("Startup complete, took %.f seconds!", finishseconds); } if ((finishmseconds > 1) || (finishmseconds == 0)) { LOG("Startup complete, took %i miliseconds!", finishmseconds); } // Milisecs, why not :P
else { LOG("Startup complete, took 1 second!"); } else { LOG("Startup complete, took 1 milisecond!"); }
while (!m_bStop && !m_bRestart) // These are modified by external threads while (!m_bStop && !m_bRestart) // These are modified by external threads
{ {

View File

@ -206,8 +206,8 @@ bool cServer::InitServer(cIniFile & a_SettingsIni)
return false; return false;
} }
LOGD("Compatible clients: %s", MCS_CLIENT_VERSIONS); LOGINFO("Compatible clients: %s", MCS_CLIENT_VERSIONS);
LOGD("Compatible protocol versions %s", MCS_PROTOCOL_VERSIONS); LOGINFO("Compatible protocol versions %s", MCS_PROTOCOL_VERSIONS);
if (cSocket::WSAStartup() != 0) // Only does anything on Windows, but whatever if (cSocket::WSAStartup() != 0) // Only does anything on Windows, but whatever
{ {