note 93568 modified in function.microtime by danbrown
| From: | danbrown@php.net | Date: | Wed, 16 Sep 2009 17:20:09 +0000 |
| Subject: | note 93568 modified in function.microtime by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-160753@lists.php.net to get a copy of this message | ||
Check Program runtime:
<?php
class bwruntime
{
var $timestart;
var $digits;
function bwruntime($digits = "")
{
$this->timestart = explode (' ', microtime());
$this->digits = $digits;
}
function totaltime()
{
$timefinish = explode (' ', microtime());
if($this->digits == ""){
$runtime_float = $timefinish[0] - $this->timestart[0];
}else{
$runtime_float = round(($timefinish[0] - $this->timestart[0]), $this->digits);
}
$runtime = ($timefinish[1] - $this->timestart[1]) + $runtime_float;
return $runtime;
}
}
?>
--was--
Check Program runtime:
<?php
// Bleakwind at www.weaverdream.com
class bwruntime
{
var $timestart;
var $digits;
function bwruntime($digits = "")
{
$this->timestart = explode (' ', microtime());
$this->digits = $digits;
}
function totaltime()
{
$timefinish = explode (' ', microtime());
if($this->digits == ""){
$runtime_float = $timefinish[0] - $this->timestart[0];
}else{
$runtime_float = round(($timefinish[0] - $this->timestart[0]), $this->digits);
}
$runtime = ($timefinish[1] - $this->timestart[1]) + $runtime_float;
return $runtime;
}
}
?>
http://php.net/manual/en/function.microtime.php