From 40a7cfff2168cec278ae1180b83d9d1ff7d2b1bb Mon Sep 17 00:00:00 2001 From: bluesaxman Date: Tue, 8 Mar 2022 13:18:34 -0700 Subject: [PATCH] Corrected a few syntax errors and cleaned up time output --- wipe.pl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/wipe.pl b/wipe.pl index 63cf7dd..12a9e0e 100755 --- a/wipe.pl +++ b/wipe.pl @@ -173,11 +173,12 @@ sub wipethemdrives { system("hdparm -F ".$disks->{$diskid}{path}." 1>/dev/null 2>/dev/null"); } if ( !($_ % 16) ) { - printf("\r%31.31s%-".($spacer+11).".".($spacer+11)."s%6.2f%% %s", + my @diskTimes = gmtime((time()-$diskStartTime)*($totalBytes/tell($longdiskw))); + printf("\r%31.31s%-".($spacer+11).".".($spacer+11)."s%6.2f%% %-20s", "Zeroing ".$disks->{$diskid}{path}, "."x(tell($longdiskw)/$totalBytes*($spacer+11)), - (tell($longdiskw)/$totalBytes)*100 ), - "ETA: ".gmtime((time()-$diskStartTime)*($totalBytes/tell($longdiskw))); + (tell($longdiskw)/$totalBytes)*100 , + "ETA: ".$diskTimes[7].", )".$diskTimes[2].":".$diskTimes[1].":".$diskTimes[0]; } } my $leftover = $totalBytes - tell($longdiskw); @@ -250,7 +251,8 @@ while () { $currentCount++; print "="x80; print "\nCurrent Overall Progress ".$currentCount."/".$batchcount." (".sprintf("%5f%%",100*$currentCount/$batchcount).")\n"; - print "Current Overall ETA: ".gmtime((time() - $startTime) * ($batchcount/$currentCount))."\n"; + my @overTime = gmtime((time() - $startTime) * ($batchcount/$currentCount)); + print "Current Overall ETA: ".$overTime[7].", ".$overTime[2].":".$overTime[1].":".$overTime[0]."\n"; print "="x33; printf '[ %-10s ]', $diskid; say "="x33;