cURL / Mailing Lists / curl-library / Single Mail

curl-library

Bad double/long cast for progress.timespent, wrongCurl_pgrsUpdate placement in Curl_pgrsDone,

From: Dirk Manske <dm_at_sysformance.com>
Date: Thu, 1 Apr 2004 18:39:59 +0200

Hi Daniel,

since release 1.58 of progress.c there is bad casting mistake, which makes
CURLINFO_TOTAL_TIME truncated to full seconds. Excerpt of the diff:

- /* The exact time spent so far (from the start) */
- timespent = (double)Curl_tvdiff (now, data->progress.start)/1000;
+ /* The time spent so far (from the start) */
+ timespent = Curl_tvdiff(now, data->progress.start)/1000;

- data->progress.timespent = timespent;
+ data->progress.timespent = (double)timespent;

data->progress.timespent = Curl_tvdiff (now, data->progress.start)/1000.0;
would be better.

And I think in Curl_pgrsDone() is a mistake. Should not be
Curl_pgrsUpdate(conn) in front of the "if" statement?

void Curl_pgrsDone(struct connectdata *conn)
{
  struct SessionHandle *data = conn->data;
  if(!(data->progress.flags & PGRS_HIDE)) {
    Curl_pgrsUpdate(conn); /* the final (forced) update */
    data->progress.lastshow=0;
    if(!data->progress.callback)
      /* only output if we don't use progress callback */
      fprintf(data->set.err, "\n");
  }
}

Bye,
D
Received on 2004-04-01