From 7095a1626b361f5ab787056ad771092327103c80 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Tue, 6 Jul 2010 11:47:43 +0000 Subject: [PATCH] 2010-07-06 Ramon Novoa * pandora_windows_service.cc: Fixed the autotime feature. Was not working since tinyXML was removed. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2964 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_agents/win32/ChangeLog | 5 +++++ .../win32/pandora_windows_service.cc | 22 +++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/pandora_agents/win32/ChangeLog b/pandora_agents/win32/ChangeLog index 817ac59b25..217225cec6 100644 --- a/pandora_agents/win32/ChangeLog +++ b/pandora_agents/win32/ChangeLog @@ -1,3 +1,8 @@ +2010-07-06 Ramon Novoa + + * pandora_windows_service.cc: Fixed the autotime feature. Was not + working since tinyXML was removed. + 2010-07-05 Raul Mateos * bin/pandora_agent.conf: Added example of D Drive. Added comments diff --git a/pandora_agents/win32/pandora_windows_service.cc b/pandora_agents/win32/pandora_windows_service.cc index 5a857d8b71..ef16e42400 100644 --- a/pandora_agents/win32/pandora_windows_service.cc +++ b/pandora_agents/win32/pandora_windows_service.cc @@ -183,7 +183,7 @@ Pandora_Windows_Service::pandora_init () { string Pandora_Windows_Service::getXmlHeader () { char timestamp[20]; - string agent_name, os_name, os_version, encoding, value; + string agent_name, os_name, os_version, encoding, value, xml; time_t ctime; struct tm *ctime_tm = NULL; @@ -197,6 +197,7 @@ Pandora_Windows_Service::getXmlHeader () { ctime = time(0); ctime_tm = localtime(&ctime); value = conf->getValue ("autotime"); + timestamp[0] = '\0'; if (value != "1") { sprintf (timestamp, "%d-%02d-%02d %02d:%02d:%02d", ctime_tm->tm_year + 1900, ctime_tm->tm_mon + 1, ctime_tm->tm_mday, ctime_tm->tm_hour, @@ -213,15 +214,22 @@ Pandora_Windows_Service::getXmlHeader () { encoding = "ISO-8859-1"; } - return "\n" + - "getValue ("description") + - "\" version=\"" + getPandoraAgentVersion () + - "\" timestamp=\"" + timestamp + - "\" interval=\"" + conf->getValue ("interval") + + xml = "\n" + + "getValue ("description") + + "\" version=\"" + getPandoraAgentVersion (); + + /* Skip the timestamp if autotime was enabled */ + if (timestamp[0] != '\0') { + xml += "\" timestamp=\""; + xml += timestamp; + } + + xml += "\" interval=\"" + conf->getValue ("interval") + "\" os_name=\"" + os_name + "\" os_version=\"" + os_version + "\" group=\"" + conf->getValue ("group") + "\">\n"; + return xml; } int