fix timezone argument local

This commit is contained in:
garnier-quentin 2019-01-11 13:45:08 +01:00
parent c64bfaecb5
commit 88075c40f9
1 changed files with 5 additions and 4 deletions

View File

@ -491,10 +491,11 @@ sub set_timezone {
return { time_zone => DateTime::TimeZone->new(name => $options{name}) };
}
centreon::plugins::misc::mymodule_load(output => $options{output}, module => 'POSIX',
error_msg => "Cannot load module 'POSIX'.");
$ENV{TZ} = $options{name};
POSIX::tzset();
# try to manage syntax (:Pacific/Noumea for example)
if ($options{name} =~ /^:(.*)$/ && DateTime::TimeZone->is_valid_name($1)) {
return { time_zone => DateTime::TimeZone->new(name => $1) };
}
return {};
}