Don't divide by zero to calculate the ETA, even if we haven't gotten

any data in 30 seconds.
This commit is contained in:
fenner 2002-11-12 07:09:43 +00:00
parent b3245bbb2f
commit 73fa7c5c52

View File

@ -150,7 +150,7 @@ stat_display(struct xferstat *xs, int force)
fprintf(stderr, " (%lld bytes): %d%%", (long long)xs->size,
(int)((100.0 * xs->rcvd) / xs->size));
elapsed = xs->last.tv_sec - xs->start.tv_sec;
if (elapsed > 30) {
if (elapsed > 30 && xs->rcvd > 0) {
long remaining;
remaining = ((xs->size * elapsed) / xs->rcvd) - elapsed;