calculate download time
| From: | Rhett Hermer | Date: | Wed, 27 Jun 2001 14:35:56 +0000 |
| Subject: | calculate download time | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-55394@lists.php.net to get a copy of this message | ||
Hi,
I am trying to write code to find out how long it takes to download a file.
The code is below. When I compare to other websites which you can calculate
online, varies wildly. I do know about many factors that affect the
download times. All I want is correct forumla to caclulate.
$b = filesize("foo.zip");
echo "<br>It will take you:<br>";
$dl = (($b * 8) / (64*1000));
$sec = $dl % 60;
$min = (($dl / 3600) % 60);
$hrs = $dl / 3600;
printf ("%1.0f hours, %1.0f mins and %1.0f secs at 64k/s<br>", $hrs, $min,
$sec);
Thanks!