Jump to content

For some reason, ROUND will not give me time anymore. Please view code.


d22552000

Recommended Posts

Well, I have a problem with rounding time + microtime.  You will see what I mean below.  After much debugging I wrote this stupid thing, even though... IT USED TO BE ABLE TO JUST WRITE "echo $totaltime;"

 

It for some reason does this now... (THE PAGES TAKE ABOUT 4 SECONDS TO LOAD)

 

if ($totaltime<1) { 
$TEMPORARY = $totaltime;
$NEW = round($TEMPORARY,6);
echo "DEBUG MODE<br />";
echo "COME ON...: " . round($NEW) . "<br />"; // THIS ECHOS 0
echo "NEW: $NEW<br />"; // THIS ECHOS 4.6E-5
echo "OLD: $totaltime<br />"; // THIS ECHOS 4.60555267334E-5
}

 

PLEASE HELP ME!!!  (need it asap, this is on a PRODUCTION BOX (PHP 5))

Link to comment
Share on other sites

I use this at the page start:

 

$starttime = explode(' ', microtime());
$starttime = (float)$starttime[1] + (float)$starttime[0];

 

and this at the page end:

 

$endtime = explode(' ', microtime());
$endtime = (float)$endtime[1] + (float)$endtime[0];
$totaltime = number_format(($endtime - $starttime), 3, '.', '');
echo "<p>My server generated this page in $totaltime seconds</p>";

 

Does that help?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.