Scott,

All your method does is come up with how many kb/s you would need to achieve
to transfer the file in 1 minute.

To estimate how long it would take with a 28.8 modem connection (many sites
do this), I would do something like the following:

        -- 28.8Kbps Modem (that's kilobit, not byte, so let's convert it to KB)
        ( 28800 / 8 ) / 1024 = 3.515625

        -- So, we assume a transfer rate of approx. 3.5KB/sec
        ( y / 3.5 ) / 60 = x

x is how many minutes it will take to transfer a file of size y using a 28.8
Kbps modem.

-----Original Message-----
From: scott [gts] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 28, 2001 10:42 AM
To: php
Subject: RE: [PHP] calculate download time


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]



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