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}) }; return { time_zone => DateTime::TimeZone->new(name => $options{name}) };
} }
centreon::plugins::misc::mymodule_load(output => $options{output}, module => 'POSIX', # try to manage syntax (:Pacific/Noumea for example)
error_msg => "Cannot load module 'POSIX'."); if ($options{name} =~ /^:(.*)$/ && DateTime::TimeZone->is_valid_name($1)) {
$ENV{TZ} = $options{name}; return { time_zone => DateTime::TimeZone->new(name => $1) };
POSIX::tzset(); }
return {}; return {};
} }