--- smsdaemon/SmsDaemon.cpp 2008/06/16 11:57:48 94 +++ smsdaemon/SmsDaemon.cpp 2008/12/07 00:59:05 132 @@ -3,6 +3,8 @@ #include #include +#include + #include "common.h" #include "GsmModem.h" @@ -19,7 +21,6 @@ using namespace std; - void SmsDaemon::CreateLogMessage(SMS& sms,bool hasPlugin) { ostringstream os; @@ -33,6 +34,14 @@ void SmsDaemon::CheckSms() { + const int INTERVAL = 1000; //no of milliseconds between sms checks + timeval now = Util::GetTimeOfDay(); + + if ( Util::mTimeDiff(_lastSmsCheck,now) < INTERVAL) + return; + + _lastSmsCheck = now; + Common* cmn = Common::instance(); PluginManager* manager = cmn->GetPluginManager(); @@ -81,7 +90,7 @@ if (cmn->isDebug && kbhit()) break; - Util::Sleep(10); + Util::Sleep(100); } } @@ -90,12 +99,14 @@ { Common* cmn = Common::instance(); + srand(time(0)); cmn->daemonStart = time(0); + _lastSmsCheck = Util::GetTimeOfDay(); cmn->logMessage("--------------------------------"); cmn->logMessage( VERSION ); - cmn->logMessage( SVNVER ); + cmn->logMessage( SVNVERSION ); cmn->GetTaskManager()->LoadTasks(); cmn->GetPluginManager()->LoadPlugins();