summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2003-12-09 19:07:13 +1100
committerDarren Tucker <dtucker@zip.com.au>2003-12-09 19:07:13 +1100
commit1fb0425359f7753d0163c5dce6a3335359da8c5a (patch)
treedcec18cf3a09d54b0707269c276e2b0ae7dcf339
parent37afa9d9a463a45b0d8ac62c577deac95bc79c2b (diff)
- markus@cvs.openbsd.org 2003/12/02 12:15:10
[progressmeter.c] 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
-rw-r--r--ChangeLog9
-rw-r--r--progressmeter.c10
2 files changed, 15 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 545e5c382..648a8231a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,13 @@
7 [cipher-aes.c] 7 [cipher-aes.c]
8 fix #ifdef before #define; ok markus@ 8 fix #ifdef before #define; ok markus@
9 (RCS ID sync only, Portable already had this) 9 (RCS ID sync only, Portable already had this)
10 - markus@cvs.openbsd.org 2003/12/02 12:15:10
11 [progressmeter.c]
12 improvments from andreas@:
13 * saner speed estimate for transfers that takes less than a second by
14 rounding the time to 1 second.
15 * when the transfer is finished calculate the actual total speed
16 rather than the current speed which is given during the transfer
10 17
1120031208 1820031208
12 - (tim) [configure.ac] Bug 770. Fix --without-rpath. 19 - (tim) [configure.ac] Bug 770. Fix --without-rpath.
@@ -1545,4 +1552,4 @@
1545 - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo. 1552 - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo.
1546 Report from murple@murple.net, diagnosis from dtucker@zip.com.au 1553 Report from murple@murple.net, diagnosis from dtucker@zip.com.au
1547 1554
1548$Id: ChangeLog,v 1.3133 2003/12/09 08:05:42 dtucker Exp $ 1555$Id: ChangeLog,v 1.3134 2003/12/09 08:07:13 dtucker Exp $
diff --git a/progressmeter.c b/progressmeter.c
index 39940bd9a..7b76c959e 100644
--- a/progressmeter.c
+++ b/progressmeter.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: progressmeter.c,v 1.17 2003/11/20 11:39:28 markus Exp $"); 26RCSID("$OpenBSD: progressmeter.c,v 1.18 2003/12/02 12:15:10 markus Exp $");
27 27
28#include "progressmeter.h" 28#include "progressmeter.h"
29#include "atomicio.h" 29#include "atomicio.h"
@@ -120,14 +120,18 @@ refresh_progress_meter(void)
120 120
121 if (bytes_left > 0) 121 if (bytes_left > 0)
122 elapsed = now - last_update; 122 elapsed = now - last_update;
123 else 123 else {
124 elapsed = now - start; 124 elapsed = now - start;
125 /* Calculate true total speed when done */
126 transferred = end_pos;
127 bytes_per_second = 0;
128 }
125 129
126 /* calculate speed */ 130 /* calculate speed */
127 if (elapsed != 0) 131 if (elapsed != 0)
128 cur_speed = (transferred / elapsed); 132 cur_speed = (transferred / elapsed);
129 else 133 else
130 cur_speed = 0; 134 cur_speed = transferred;
131 135
132#define AGE_FACTOR 0.9 136#define AGE_FACTOR 0.9
133 if (bytes_per_second != 0) { 137 if (bytes_per_second != 0) {