note 34201 added to function.microtime
| From: | daniel141 at yahoo dot com | Date: | Fri, 18 Jul 2003 04:30:05 +0000 |
| Subject: | note 34201 added to function.microtime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-52317@lists.php.net to get a copy of this message | ||
Here's a fix if your getting odd numbers like this "2.0980834960938E-05 seconds"
function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
$time_start = getmicrotime();
// Code goes here...
$time_end = getmicrotime();
$time = sprintf('%.16', $time_end - $time_start);
echo 'Loaded in ' . $time . ' seconds';
Good luck!
----
Manual Page -- http://www.php.net/manual/en/function.microtime.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34201
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34201&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34201&report=yes