Use floating point arithmetic to compute the ETA to avoid integer overflow

during slow transfers of large files.
This commit is contained in:
des 2003-03-11 21:33:43 +00:00
parent c81d102698
commit 251472ad11

View File

@ -130,7 +130,7 @@ stat_eta(struct xferstat *xs)
elapsed = xs->last.tv_sec - xs->start.tv_sec;
received = xs->rcvd - xs->offset;
expected = xs->size - xs->rcvd;
eta = (elapsed * expected) / received;
eta = (long)((double)elapsed * expected / received);
if (eta > 3600) {
fprintf(stderr, "%02ld:", eta / 3600);
eta %= 3600;