RE: [PHP] calculate download time

From: Date: Thu, 28 Jun 2001 17:42:19 +0000
Subject: RE: [PHP] calculate download time
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-55516@lists.php.net to get a copy of this message
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);

« previous php.general (#55516) next »