mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-29 00:24:46 +02:00
Fix #2544
This commit is contained in:
parent
2ef1214787
commit
fe35835cc9
@ -244,16 +244,14 @@ sub get_duration {
|
|||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
# Format: [[dd-]hh:]mm:ss
|
# Format: [[dd-]hh:]mm:ss
|
||||||
my ($seconds, $min, $lpart) = split /:/, $options{elapsed};
|
$options{elapsed} =~ /(?:(\d+)-)?(?:(\d+):)?(\d+):(\d+)/;
|
||||||
my $total_seconds_elapsed = $seconds + ($min * 60);
|
my ($day, $hour, $min, $sec) = ($1, $2, $3, $4);
|
||||||
if (defined($lpart)) {
|
my $total_seconds_elapsed = $sec + ($min * 60);
|
||||||
my ($day, $hour) = split /-/, $lpart;
|
if (defined($hour)) {
|
||||||
if (defined($hour)) {
|
$total_seconds_elapsed += ($hour * 60 * 60);
|
||||||
$total_seconds_elapsed += ($hour * 60 * 60);
|
}
|
||||||
}
|
if (defined($day)) {
|
||||||
if (defined($day)) {
|
$total_seconds_elapsed += ($day * 86400);
|
||||||
$total_seconds_elapsed += ($day * 86400);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $total_seconds_elapsed;
|
return $total_seconds_elapsed;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user