Re: Wrong current speed
Date: Mon, 12 Nov 2001 08:23:17 +0100 (MET)
On Mon, 12 Nov 2001, [iso-8859-15] Andrés García wrote:
> I have noticed in version 7.9.1 that sometimes, specially with small
> files, the progress meter reports a current speed of -2048M.
Yes, I've seen it happen too. I just didn't track it as far and good as
you've did here!
> As far as I can see, the problem is in ' Curl_tvdiff ', sometimes the
> time difference is below a millisecond and the function returns '0' .
> The speed will be a bit off though, it may be better if the function
> returned a double.
Hehe, I just converted (for 7.9.1) the function from returning a double into
returning the number of milliseconds. I did that because I don't like having
to mess with doubles all over, since they're slow and not as accurate as the
number of milliseconds. Also, I wanted the amount of milliseconds in a number
Wouldn't you say a better fix would be to check the return code in the
progress meter function to see if it returns zero, and then use one instead?
Something like this:
--- progress.c 2001/10/31 14:45:47 1.34
+++ progress.c 2001/11/12 07:21:51
@@ -275,6 +275,8 @@
/* Figure out the exact time for the time span */
span_ms = Curl_tvdiff(now,
+ if(0 == span_ms)
+ span_ms=1; /* at least one millisecond MUST have passed */
/* Calculate the average speed the last 'countindex' seconds */
-- Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/Received on 2001-11-12