Re: Microtime math and display
| From: | Chris Lee | Date: | Wed, 07 Mar 2001 23:15:35 +0000 |
| Subject: | Re: Microtime math and display | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-42981@lists.php.net to get a copy of this message | ||
<?php
function mtime()
{
$mtime = microtime();
$mtime = str_replace('.', '', $mtime);
$mtime = explode(' ', $mtime);
$mtime = $mtime[1] . $mtime[0];
return($mtime);
}
class debug
{
function debug()
{
$this->start = mtime();
}
function reset()
{
$all_vars = get_object_vars($this);
foreach($all_vars as $pos => $val)
if ($pos != 'error')
unset($this->$pos);
}
function time($text = '')
{
$this->break = mtime();
$time = ($this->break - $this->start) / 1000000000;
echo number_format($time, 4) .' '. $text ."<br>\n";
$this->start = $this->break;
}
}
$debug = new debug;
//-------------------------------------------------------------------
$debug->time('start');
// code snippit
$debug->time('end');
?>
--
Chris Lee
Mediawaveonline.com
ph. 250.377.1095
ph. 250.376.2690
fx. 250.554.1120
lee@mediawaveonline.com
"Todd Cary" <todd@aristesoftware.com> wrote in message news:3AA6D172.41E61B8C@aristesoftware.com...
I want to check the time for queries. I have
$starttime = getmicrotime();
$endtime = getmicrotime();
$delta = $endtime - $starttime;
How do I display the seconds/milliseconds?
Many thanks..........
Todd
--
Todd Cary
Ariste Software
todd@aristesoftware.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net