diff options
author | des <des@FreeBSD.org> | 2003-03-11 21:33:43 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2003-03-11 21:33:43 +0000 |
commit | 2bcbb73b916ad55d896c0805ac2cb2ba2e49af71 (patch) | |
tree | 6f2c4eca6cfdb73ced7d88599bd553f34f6a4e75 /usr.bin/fetch | |
parent | f7f4727b44d784e309e121cae1fc97f2e41fd84d (diff) | |
download | FreeBSD-src-2bcbb73b916ad55d896c0805ac2cb2ba2e49af71.zip FreeBSD-src-2bcbb73b916ad55d896c0805ac2cb2ba2e49af71.tar.gz |
Use floating point arithmetic to compute the ETA to avoid integer overflow
during slow transfers of large files.
Diffstat (limited to 'usr.bin/fetch')
-rw-r--r-- | usr.bin/fetch/fetch.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c index 087d09c..00bcc76 100644 --- a/usr.bin/fetch/fetch.c +++ b/usr.bin/fetch/fetch.c @@ -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; |