This commit is contained in:
garnier-quentin 2021-01-28 09:48:41 +01:00
parent cf199cbdba
commit 0d92db9a0f
1 changed files with 8 additions and 10 deletions

View File

@ -244,17 +244,15 @@ sub get_duration {
my ($self, %options) = @_;
# Format: [[dd-]hh:]mm:ss
my ($seconds, $min, $lpart) = split /:/, $options{elapsed};
my $total_seconds_elapsed = $seconds + ($min * 60);
if (defined($lpart)) {
my ($day, $hour) = split /-/, $lpart;
$options{elapsed} =~ /(?:(\d+)-)?(?:(\d+):)?(\d+):(\d+)/;
my ($day, $hour, $min, $sec) = ($1, $2, $3, $4);
my $total_seconds_elapsed = $sec + ($min * 60);
if (defined($hour)) {
$total_seconds_elapsed += ($hour * 60 * 60);
}
if (defined($day)) {
$total_seconds_elapsed += ($day * 86400);
}
}
return $total_seconds_elapsed;
}