simple.

get total KB (1k = 1024 bytes)
divide that by 60 (seconds in a minute)
now you have estimated transfer time in minutes.

> -----Original Message-----
> From: Rhett Hermer [mailto:[EMAIL PROTECTED]]
> Subject: [PHP] calculate download time
> 
> 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);


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to