This commit is contained in:
garnier-quentin 2021-01-28 09:48:41 +01:00
parent 2ef1214787
commit fe35835cc9

View File

@ -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;