From 884936b82bd2e0f407408219e49f464487f4e17f Mon Sep 17 00:00:00 2001
From: Ramon Novoa <rnovoa@artica.es>
Date: Thu, 31 Jul 2008 10:31:58 +0000
Subject: [PATCH] 2008-07-31  Ramon Novoa  <rnovoa@artica.es>

	* win32/pandora_windows_service.cc: Small fixes.
        * win32/modules/pandora_module.cc: time() and localtime() are used
          instead of GetSystemTime().
        * win32/pandora.h: Changed all instances of "Pandora" to
          "Pandora FMS".




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@989 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
---
 pandora_agents/ChangeLog                        |  8 ++++++++
 pandora_agents/win32/modules/pandora_module.cc  |  2 +-
 pandora_agents/win32/pandora.h                  |  6 +++---
 pandora_agents/win32/pandora_windows_service.cc | 13 +++++++++----
 4 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/pandora_agents/ChangeLog b/pandora_agents/ChangeLog
index a367340aba..3c9254e143 100644
--- a/pandora_agents/ChangeLog
+++ b/pandora_agents/ChangeLog
@@ -1,3 +1,11 @@
+2008-07-31  Ramon Novoa  <rnovoa@artica.es>
+
+	* win32/pandora_windows_service.cc: Small fixes.
+	* win32/modules/pandora_module.cc: time() and localtime() are used
+	  instead of GetSystemTime().
+	* win32/pandora.h: Changed all instances of "Pandora" to
+	  "Pandora FMS".
+
 2008-07-30  Ramon Novoa  <rnovoa@artica.es>
 
 	* win32/windows/pandora_wmi.cc: Fixed typo bug.
diff --git a/pandora_agents/win32/modules/pandora_module.cc b/pandora_agents/win32/modules/pandora_module.cc
index dbd897f645..eaadd126b0 100644
--- a/pandora_agents/win32/modules/pandora_module.cc
+++ b/pandora_agents/win32/modules/pandora_module.cc
@@ -318,7 +318,7 @@ Pandora_Module::getXml () {
 	
 	pandoraDebug ("%s getXML begin", module_name.c_str ());
 	
-	if (!this->has_output || (this->data_list && this->data_list->size () < 1)) {
+	if (!this->has_output || this->data_list == NULL) {
                 return NULL;
         }
         
diff --git a/pandora_agents/win32/pandora.h b/pandora_agents/win32/pandora.h
index a34cdbe5e1..37447bb6ee 100644
--- a/pandora_agents/win32/pandora.h
+++ b/pandora_agents/win32/pandora.h
@@ -51,9 +51,9 @@ namespace Pandora {
         };
         
         static const HKEY  hkey          = HKEY_LOCAL_MACHINE;
-        const char * const name          = "PandoraAgent";
-        const char * const display_name  = "Pandora agent";
-        const char * const description   = "The Pandora Agent service";
+        const char * const name          = "PandoraFMSAgent";
+        const char * const display_name  = "Pandora FMS agent";
+        const char * const description   = "The Pandora FMS Agent service";
 
         void   setPandoraInstallDir   (string dir);
         string getPandoraInstallDir   ();
diff --git a/pandora_agents/win32/pandora_windows_service.cc b/pandora_agents/win32/pandora_windows_service.cc
index 361dd07687..bad9f92c5c 100644
--- a/pandora_agents/win32/pandora_windows_service.cc
+++ b/pandora_agents/win32/pandora_windows_service.cc
@@ -144,9 +144,10 @@ Pandora_Windows_Service::pandora_init () {
 TiXmlElement *
 Pandora_Windows_Service::getXmlHeader () {
 	TiXmlElement *agent;
-	SYSTEMTIME    st;
 	char          timestamp[20];
 	string        value;
+	time_t        ctime;
+	struct tm     *ctime_tm = NULL;
 	
 	agent = new TiXmlElement ("agent_data");
 	
@@ -158,9 +159,13 @@ Pandora_Windows_Service::getXmlHeader () {
 	
 	agent->SetAttribute ("version", getPandoraAgentVersion ());
 	
-	GetSystemTime(&st);
-	sprintf (timestamp, "%d-%02d-%02d %02d:%02d:%02d", st.wYear, st.wMonth, st.wDay,
-		 st.wHour, st.wMinute, st.wSecond);
+	// Get current time
+	ctime = time(0);
+    ctime_tm = localtime(&ctime);
+
+	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,
+		ctime_tm->tm_min, ctime_tm->tm_sec);
 	
 	agent->SetAttribute ("timestamp", timestamp);