Take the 2-minute tour ×  I made a download script which records
the time when a user started a download, and then again when the
download finishes because I want to be able to check a persons
average download speed. For some reason it's not recording the
times properly.  I timed a 40ish MB download with a spot watch,
which took around 35 seconds but for some reason the script
reported it took 181 seconds.  My speed script(just pulls info
from database) outputs:  42793248 bytes, downloaded in
(1333153897 - 1333153716 =) 181 seconds, so MB/s =
0.22547415211714 (mbytes / time)  I confirmed the bytes &
seconds values in my database.  I know the script isn't running
for that long, because as soon as I opened the page the download
starts(within a second or 2) then when the download finished I
checked the database and it was already inserted with these
values above.  Here are the more relevent parts of the download
script(I think):     $download_id = $_GET['id'];  $traffic = 0;
$started = time();  function headers(