--- smsdaemon/common.cpp 2008/06/09 18:15:53 26 +++ smsdaemon/common.cpp 2008/06/11 14:25:08 55 @@ -8,7 +8,7 @@ #include using namespace std; -char* Months[] = { "", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov","Dec"}; +const char* Months[] = { "", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov","Dec"}; Common* Common::instance() { @@ -95,3 +95,19 @@ if (! ( isDaemon || isDebug)) printUsage(); } + + +std::string Common::getStatusMessage() +{ + long int now = time(0); + + long int diff = now - this->daemonStart; + + + std::ostringstream out; + out << "Uptime " << diff << " seconds. "; + out << "Messages received:" << this->smsCounter.incomming << ". "; + out << "Messages sent:" << this->smsCounter.outgoing << "."; + + return out.str(); +}