<?php
/**
 * Misst Zeiten, Beispielsweise von Scriptlaufzeit und oder Datenbankabfragen.
 * 
 * @license myHP, the construct for every webpage you want.
    Copyright (C) 2010  Stefan 'Eichi' Eichhorst <eichi@blubbbel.de>
    
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.
    
    You should have received a copy of the GNU Lesser General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * @package EoT-Clan BF3 Leaderboard
 * @copyright Eichi (Stefan Eichhorst)
 * @author Eichi - eichi@blubbbel.eu
 */

class timing {
	
	public $iLaufzeit = 0;
	
	/**
	 * Misst Scriptlaufzeiten. 
	 * Solange $sStart nicht auf nein gesetzt wird, wird timer automatisch mitgestartet.
	 *
	 * @param String $sStart
	 */
	public function __construct ($sStart = "ja"){
		if ($sStart == "ja"){
			$this->start();
		}
	}
	
	/**
	 * Startet Timer
	 *
	 */
	public function start (){
		$this->iLaufzeit = microtime(true);
	}
	
	/**
	 * Stoppt Timer
	 * 
	 * @return Integer
	 */
	public function stop (){
		$this->iLaufzeit = microtime(true)-$this->iLaufzeit;
		
		return $this->iLaufzeit;
	}
	
}
