fetch: print total time when done, instead of 0.0 remaining

This commit is contained in:
K. Lange 2021-09-13 10:47:36 +09:00
parent c24d743740
commit d9d3f52fa8

View File

@ -101,12 +101,13 @@ void print_progress(int force) {
fprintf(stderr," %.2f Kbps", s);
}
if (fetch_options.content_length) {
if (!force && fetch_options.content_length) {
if (rate > 0.0) {
double remaining = (double)(fetch_options.content_length - fetch_options.size) / rate;
fprintf(stderr," (%.2f sec remaining)", remaining);
}
} else {
fprintf(stderr," (%.2f sec elapsed)", timediff);
}
}
fprintf(stderr,"\033[K\033[?25h");