summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/progressmeter.c
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2003-12-02 12:15:11 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2003-12-02 12:15:11 +0000
commit0cb0f5f73d334a89cf05f917d75d5b7ec6c52917 (patch)
tree9101f1b878428a40c46add589e4c4600398e04af /usr.bin/ssh/progressmeter.c
parent5844c9d38b54be608dd4ff5e12f052043045e35f (diff)
improvments from andreas@:
* saner speed estimate for transfers that takes less than a second by rounding the time to 1 second. * when the transfer is finished calculate the actual total speed rather than the current speed which is given during the transfer
Diffstat (limited to 'usr.bin/ssh/progressmeter.c')
-rw-r--r--usr.bin/ssh/progressmeter.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/ssh/progressmeter.c b/usr.bin/ssh/progressmeter.c
index c165e6e6909..44542d88bd7 100644
--- a/usr.bin/ssh/progressmeter.c
+++ b/usr.bin/ssh/progressmeter.c
@@ -23,7 +23,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: progressmeter.c,v 1.17 2003/11/20 11:39:28 markus Exp $");
+RCSID("$OpenBSD: progressmeter.c,v 1.18 2003/12/02 12:15:10 markus Exp $");
#include "progressmeter.h"
#include "atomicio.h"
@@ -119,14 +119,18 @@ refresh_progress_meter(void)
if (bytes_left > 0)
elapsed = now - last_update;
- else
+ else {
elapsed = now - start;
+ /* Calculate true total speed when done */
+ transferred = end_pos;
+ bytes_per_second = 0;
+ }
/* calculate speed */
if (elapsed != 0)
cur_speed = (transferred / elapsed);
else
- cur_speed = 0;
+ cur_speed = transferred;
#define AGE_FACTOR 0.9
if (bytes_per_second != 0) {