From ecb56647632305132fd32eece0a5bf89b018689c Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 1 Mar 2021 14:00:39 +0000 Subject: [PATCH] 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 Signed-off-by: Jonathan Druart --- misc/migration_tools/rebuild_zebra.pl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl index 8fd611a83b..18da8026ad 100755 --- a/misc/migration_tools/rebuild_zebra.pl +++ b/misc/migration_tools/rebuild_zebra.pl @@ -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"; } -- 2.39.5