my $current = shift;
my $total = shift || 1;
my $p = int($current * 100 / $total);
- if ($p != $last_p) {
+ if ($p < $last_p) {
+ $start_t = time();
+ } elsif ($p != $last_p) {
my $rate = ($current / (time() - $start_t || 1));
my $eta = ($total-$current) / ($rate || 1);
printf STDERR ("%5d [%-38s] %-5d %0.1f/s %s\r",$current,"=" x ($p/3)."$p%>", $total, $rate, fmt_time($eta));