<?php
	defined( "_VALID_PAGE_MONITOR" ) or die (_NODIRECTACCESS);
	
	class Timer{
		private $start;
		private $elapsed_time;
		private $script_start;
		
		function Timer(){
			$this->start();
		}
		
		function start(){
			$this->start = time();
			$this->elapsed_time = NULL;
			
			list($usec, $sec) = explode(' ', microtime());
		  $this->script_start = (float) $sec + (float) $usec;
			
		}
		
		function end(){
			list($usec, $sec) = explode(' ', microtime());
   		$script_end = (float) $sec + (float) $usec;
   		$this->elapsed_time = round($script_end - $this->script_start, 5);
		}
		
		function endTimerAndGetString(){
			$this->end();
			return $this->elapsed_time;
		}
	}
?>
