From d3ca5862b41a17bb09c1acfec48e12887ffead36 Mon Sep 17 00:00:00 2001 From: Calvo Date: Wed, 17 Jan 2024 11:01:25 +0100 Subject: [PATCH] #12222 Fix timezone offset when modules has timezone data --- pandora_server/lib/PandoraFMS/DataServer.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pandora_server/lib/PandoraFMS/DataServer.pm b/pandora_server/lib/PandoraFMS/DataServer.pm index 80e8bb4bd3..7dfee63af3 100644 --- a/pandora_server/lib/PandoraFMS/DataServer.pm +++ b/pandora_server/lib/PandoraFMS/DataServer.pm @@ -627,6 +627,11 @@ sub process_xml_data ($$$$$) { my $module_type = get_tag_value ($module_data, 'type', 'generic_data'); + # Apply timezone offset to module if timestamp is set. + if (defined($module_data->{'timestamp'} && $module_data->{'timestamp'} ne '')) { + $module_data->{'timestamp'} = strftime ("%Y-%m-%d %H:%M:%S", localtime($module_data->{'timestamp'} + ($timezone_offset * 3600))); + } + # Single data if (! defined ($module_data->{'datalist'})) { my $data_timestamp = get_tag_value ($module_data, 'timestamp', $timestamp);