aboutsummaryrefslogtreecommitdiff
path: root/lib/progress.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-11-12 08:50:59 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-11-12 08:50:59 +0000
commitc55d0bb80435aef2e06a34c006da410b47982d92 (patch)
treeaf74c2f739a57f58374964c47aed35bd8dfc47b4 /lib/progress.c
parent0ffec712e1b6479ff236d387c3d6b17d66f61881 (diff)
We need at least one millisecond to calculate current speed with! I also
made the getinfo() stuff divide with 1000.0 now to enforce floating point since Paul Harrington claims the 7.9.1 still uses even second resolution in the timers there
Diffstat (limited to 'lib/progress.c')
-rw-r--r--lib/progress.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/progress.c b/lib/progress.c
index c4b1f5153..865744654 100644
--- a/lib/progress.c
+++ b/lib/progress.c
@@ -119,15 +119,15 @@ void Curl_pgrsTime(struct SessionHandle *data, timerid timer)
case TIMER_NAMELOOKUP:
data->progress.t_nslookup +=
- (double)Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle)/1000;
+ (double)Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle)/1000.0;
break;
case TIMER_CONNECT:
data->progress.t_connect +=
- (double)Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle)/1000;
+ (double)Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle)/1000.0;
break;
case TIMER_PRETRANSFER:
data->progress.t_pretransfer +=
- (double)Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle)/1000;
+ (double)Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle)/1000.0;
break;
case TIMER_POSTRANSFER:
/* this is the normal end-of-transfer thing */
@@ -275,6 +275,8 @@ int Curl_pgrsUpdate(struct connectdata *conn)
/* Figure out the exact time for the time span */
span_ms = Curl_tvdiff(now,
data->progress.speeder_time[checkindex]);
+ if(0 == span_ms)
+ span_ms=1; /* at least one millisecond MUST have passed */
/* Calculate the average speed the last 'countindex' seconds */
data->progress.current_speed =