cURL / Mailing Lists / curl-library / Single Mail

curl-library

Wrong current speed

From: Andrés García <fandom_at_retemail.es>
Date: Mon, 12 Nov 2001 01:31:40 +0100

Hi,

I have noticed in version 7.9.1 that sometimes, specially with small files,
the progress meter reports a current speed of -2048M.

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' .

A simple way to solve it can be:

long Curl_tvdiff (struct timeval t1, struct timeval t2)
{
  long diff;

  diff=(t1.tv_sec*1000 + t1.tv_usec/1000)-
    (t2.tv_sec*1000 + t2.tv_usec/1000);

  if(diff) {
    return diff;
  } else {
    return 1;
  }
}

The speed will be a bit off though, it may be better if the function returned
a double.

Andres
Received on 2001-11-12