cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Determine download speed

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 13 Jun 2010 23:59:36 +0200 (CEST)

On Sun, 13 Jun 2010, Patrick K. wrote:

>> That you can do, but you need to add up the total amount of data to make it
>> right. Or use the progress callback that includes the total size among its
>> arguments.
>
> I'm (already) trying to do it but I'm running into a problem again and
> again. The callback is called very fast so the precision of seconds is not
> more enough.

You said average download speed, right? So remember the time the download
started - before the transfer starts. Then you count the total number of bytes
within the callback and check how long time it is since the download started.
It won't matter how fast the callback is called.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-06-13