Page 1 of 1

page load time

Posted: Sun Apr 04, 2004 4:56 pm
by bawla
this is the code im using for page load time

Code: Select all

<?php
 $m_time = explode(" ",microtime());
 $m_time = $m_time[0] + $m_time[1];
 $starttime = $m_time;
?>



<?php
 $round = 8;// The number of decimal places to round the micro time to.
 $m_time = explode(" ",microtime());
 $m_time = $m_time[0] + $m_time[1];
 $endtime = $m_time;
 $totaltime = ($endtime - $starttime);
 echo "" . round($totaltime,$round) ." seconds";
?>
but when it is exicuted i get something like

5.698E-05 seconds

Posted: Sun Apr 04, 2004 5:38 pm
by Illusionist
why do you have the round up so high?? try setting it to 3, maybe 2

Posted: Sun Apr 04, 2004 5:40 pm
by Illusionist
just incase you didn't know:

5.698E-05 seconds == .00005698 seconds

Posted: Sun Apr 04, 2004 7:37 pm
by bawla
when i do 2 to 4 i get 0 seconds

at 5 i get something like 4E-05 seconds , which i know equals .00004

Posted: Sun Apr 04, 2004 7:45 pm
by Illusionist
hmm... thats wierd. for some reason its return in scientific notation. Mine doesn't though. What OS are you running?

Posted: Mon Apr 05, 2004 8:29 am
by bawla
the server?

its linux

Posted: Mon Apr 05, 2004 8:44 am
by Illusionist
hmm... I wonder if anyone else running Linux tries this script if thats what they get too? Im running Windows, and it seems to come out fine for me.