--- NetworkServer.pm.orig	2011-12-02 00:00:09.000000000 +0100
+++ NetworkServer.pm	2012-04-02 17:19:46.984940843 +0200
@@ -92,7 +92,7 @@
 	my $network_filter = enterprise_hook ('get_network_filter', [$pa_config]);
 	
 	if ($pa_config->{'pandora_master'} == 0) {
-		@rows = get_db_rows ($dbh, 'SELECT tagente_modulo.id_agente_modulo, tagente_modulo.flag, UNIX_TIMESTAMP() - tagente_estado.current_interval - tagente_estado.last_execution_try AS time_left, last_execution_try
+		@rows = get_db_rows ($dbh, 'SELECT tagente_modulo.id_agente_modulo, tagente_modulo.flag, CAST(UNIX_TIMESTAMP() - tagente_estado.current_interval AS SIGNED ) - tagente_estado.last_execution_try AS time_left, last_execution_try
 		FROM tagente, tagente_modulo, tagente_estado
 		WHERE server_name = ?
 		AND tagente_modulo.id_agente = tagente.id_agente
@@ -105,7 +105,7 @@
 		AND (tagente_modulo.flag = 1 OR ((tagente_estado.last_execution_try + tagente_estado.current_interval) < UNIX_TIMESTAMP())) 
 		ORDER BY tagente_modulo.flag DESC, time_left DESC, tagente_estado.last_execution_try ASC ', $pa_config->{'servername'});
     } else {
-		@rows = get_db_rows ($dbh, 'SELECT DISTINCT(tagente_modulo.id_agente_modulo), tagente_modulo.flag, tagente_estado.last_execution_try, UNIX_TIMESTAMP() - tagente_estado.current_interval - tagente_estado.last_execution_try  AS time_left, last_execution_try
+		@rows = get_db_rows ($dbh, 'SELECT DISTINCT(tagente_modulo.id_agente_modulo), tagente_modulo.flag, tagente_estado.last_execution_try, CAST(UNIX_TIMESTAMP() - tagente_estado.current_interval AS SIGNED) - tagente_estado.last_execution_try  AS time_left, last_execution_try
 		FROM tagente, tagente_modulo, tagente_estado
 		WHERE ((server_name = ?) OR (server_name = ANY(SELECT name FROM tserver WHERE status = 0))) 
 		AND tagente_modulo.id_agente = tagente.id_agente
--- PluginServer.pm.orig	2011-12-02 00:00:09.000000000 +0100
+++ PluginServer.pm	2012-04-02 17:20:24.280939511 +0200
@@ -89,7 +89,7 @@
 	my @rows;
 
 	if ($pa_config->{'pandora_master'} != 1) {
-		@rows = get_db_rows ($dbh, 'SELECT tagente_modulo.id_agente_modulo, tagente_modulo.flag, UNIX_TIMESTAMP() - tagente_estado.current_interval - tagente_estado.last_execution_try  AS time_left, last_execution_try
+		@rows = get_db_rows ($dbh, 'SELECT tagente_modulo.id_agente_modulo, tagente_modulo.flag, CAST(UNIX_TIMESTAMP() - tagente_estado.current_interval AS SIGNED) - tagente_estado.last_execution_try  AS time_left, last_execution_try
 			FROM tagente, tagente_modulo, tagente_estado
 			WHERE server_name = ?
 			AND tagente_modulo.id_agente = tagente.id_agente
@@ -100,7 +100,7 @@
 			AND (tagente_modulo.flag = 1 OR (tagente_estado.last_execution_try + tagente_estado.current_interval) < UNIX_TIMESTAMP())
 			ORDER BY tagente_modulo.flag DESC, time_left DESC, last_execution_try ASC', $pa_config->{'servername'});
     } else {
-		@rows = get_db_rows ($dbh, 'SELECT DISTINCT(tagente_modulo.id_agente_modulo), tagente_modulo.flag, UNIX_TIMESTAMP() - tagente_estado.current_interval - tagente_estado.last_execution_try  AS time_left, last_execution_try
+		@rows = get_db_rows ($dbh, 'SELECT DISTINCT(tagente_modulo.id_agente_modulo), tagente_modulo.flag, CAST(UNIX_TIMESTAMP() - tagente_estado.current_interval AS SIGNED)- tagente_estado.last_execution_try  AS time_left, last_execution_try
 			FROM tagente, tagente_modulo, tagente_estado
 			WHERE ((server_name = ?) OR (server_name = ANY(SELECT name FROM tserver WHERE status = 0)))
 			AND tagente_modulo.id_agente = tagente.id_agente
--- WMIServer.pm.orig	2011-12-02 00:00:09.000000000 +0100
+++ WMIServer.pm	2012-04-02 17:21:06.164939420 +0200
@@ -89,7 +89,7 @@
 	my @rows;
 
 	if ($pa_config->{'pandora_master'} != 1) {
-		@rows = get_db_rows ($dbh, 'SELECT tagente_modulo.id_agente_modulo, tagente_modulo.flag, UNIX_TIMESTAMP() - tagente_estado.current_interval - tagente_estado.last_execution_try  AS time_left, last_execution_try
+		@rows = get_db_rows ($dbh, 'SELECT tagente_modulo.id_agente_modulo, tagente_modulo.flag, CAST(UNIX_TIMESTAMP() - tagente_estado.current_interval AS SIGNED) - tagente_estado.last_execution_try  AS time_left, last_execution_try
 			FROM tagente, tagente_modulo, tagente_estado
 			WHERE server_name = ?
 			AND tagente_modulo.id_agente = tagente.id_agente
@@ -101,7 +101,7 @@
 			OR tagente_modulo.flag = 1)				
 			ORDER BY tagente_modulo.flag DESC, time_left DESC, last_execution_try ASC', $pa_config->{'servername'});		
 	} else {
-		@rows = get_db_rows ($dbh, 'SELECT DISTINCT(tagente_modulo.id_agente_modulo), tagente_modulo.flag, UNIX_TIMESTAMP() - tagente_estado.current_interval - tagente_estado.last_execution_try AS time_left, last_execution_try
+		@rows = get_db_rows ($dbh, 'SELECT DISTINCT(tagente_modulo.id_agente_modulo), tagente_modulo.flag, CAST(UNIX_TIMESTAMP() - tagente_estado.current_interval AS SIGNED )- tagente_estado.last_execution_try AS time_left, last_execution_try
 			FROM tagente, tagente_modulo, tagente_estado, tserver
 			WHERE ((server_name = ?) OR (server_name = ANY(SELECT name FROM tserver WHERE status = 0)))
 			AND tagente_modulo.id_agente = tagente.id_agente
