<?php
/*
Name: class.microtime.php
Description: This class handles the getmicrotime() function.
Author: Common Rountine, class created by Lukas Mestan
Encoding: UTF-8
Date: 2009-01-12
*/
class microtime
{
// The variables of the class
var $time_microtime; // The time of parsing the page.
var $time_start; // The time at the start of parsing the page.
var $time_end; // The time at the end of parsing the page.
// Function: getmicrotime();
// Description: Gets the microtime.
function getmicrotime() {
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
// Function: start();
// Description: Starts counting the time of parsing the page.
function start(){
$this->time_microtime = 0;
$this->time_start = $this->getmicrotime();
}
// Function: getactual();
// Description: Gets the actual time of parsing the page into time_microtime.
function getactual(){
$this->time_microtime = $this->getmicrotime() - $this->time_start;
}
// Function: stop();
// Description: Stops counting the time of parsing the page and outputs to time_microtime.
function stop(){
$this->time_end = $this->getmicrotime();
$this->time_microtime = $this->time_end - $this->time_start;
}
}
?>