RE: [PHP] calculate download time
| From: | Tyrone Mills | Date: | Fri, 29 Jun 2001 16:05:43 +0000 |
| Subject: | RE: [PHP] calculate download time | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-55566@lists.php.net to get a copy of this message | ||
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:scott@graphictype.com]
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:rhetth@info-logic.co.za]
> 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: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net