diff --git a/progress.c b/progress.c index 87207fbf..039c9616 100644 --- a/progress.c +++ b/progress.c @@ -94,14 +94,18 @@ static void rprint_progress(OFF_T ofs, OFF_T size, struct timeval *now, int is_l if (!ph_start.time.tv_sec || !(diff = msdiff(&ph_start.time, now))) diff = 1; rate = (double) (ofs - ph_start.ofs) * 1000.0 / diff / 1024.0; - /* Switch to total time taken for our last update. */ - remain = (double) diff / 1000.0; } else { strlcpy(eol, " ", sizeof eol); /* Compute stats based on recent progress. */ if (!(diff = msdiff(&ph_list[oldest_hpos].time, now))) diff = 1; rate = (double) (ofs - ph_list[oldest_hpos].ofs) * 1000.0 / diff / 1024.0; + } + + if (!INFO_GTE(PROGRESS, 2) && is_last) { + /* Switch to total time taken for our last update. */ + remain = (double) diff / 1000.0; + } else { remain = rate ? (double) (size - ofs) / rate / 1000.0 : 0.0; }