Skip to content

Commit 43d1da9

Browse files
tinnamchoitridge
authored andcommitted
fix: make --info=progress2 consistently display time-remaining
1 parent 4f6e4ea commit 43d1da9

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

progress.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,18 @@ static void rprint_progress(OFF_T ofs, OFF_T size, struct timeval *now, int is_l
9494
if (!ph_start.time.tv_sec || !(diff = msdiff(&ph_start.time, now)))
9595
diff = 1;
9696
rate = (double) (ofs - ph_start.ofs) * 1000.0 / diff / 1024.0;
97-
/* Switch to total time taken for our last update. */
98-
remain = (double) diff / 1000.0;
9997
} else {
10098
strlcpy(eol, " ", sizeof eol);
10199
/* Compute stats based on recent progress. */
102100
if (!(diff = msdiff(&ph_list[oldest_hpos].time, now)))
103101
diff = 1;
104102
rate = (double) (ofs - ph_list[oldest_hpos].ofs) * 1000.0 / diff / 1024.0;
103+
}
104+
105+
if (!INFO_GTE(PROGRESS, 2) && is_last) {
106+
/* Switch to total time taken for our last update. */
107+
remain = (double) diff / 1000.0;
108+
} else {
105109
remain = rate ? (double) (size - ofs) / rate / 1000.0 : 0.0;
106110
}
107111

0 commit comments

Comments
 (0)