Bug 27048: (follow-up) Correction to elapsed printing

JD Amended patch: Remove perlcritic error
"$d" is declared but not used at line 839, column 5.  Unused variables clutter code and make it harder to read.  (Severity: 3)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Martin Renvoize 2021-03-01 14:00:39 +00:00 committed by Jonathan Druart
parent fe1705f947
commit ecb5664763
1 changed files with 2 additions and 4 deletions

View File

@ -836,17 +836,15 @@ sub pretty_time {
my $now = time;
my $elapsed = $now - $start_time;
local $_ = $elapsed;
my ( $d, $h, $m, $s );
my ( $h, $m, $s );
$s = $_ % 60;
$_ /= 60;
$m = $_ % 60;
$_ /= 60;
$h = $_ % 24;
$_ /= 24;
$d = $_;
my $now_pretty = POSIX::strftime("%H:%M:%S",localtime($now));
my $elapsed_pretty = $d ? "[$d:$h:$m:$s]" : $h ? "[$h:$m:$s]" : $m ? "[$m:$s]" : "[$s]";
my $elapsed_pretty = sprintf "[%02d:%02d:%02d]",$h,$m,$s;
return "$now_pretty $elapsed_pretty";
}