cvs: php-benchmarks /benchcli/misc timer.php

From: Date: Thu, 28 May 2009 13:34:15 +0000
Subject: cvs: php-benchmarks /benchcli/misc timer.php
Groups: php.qa 
Request: Send a blank email to php-qa+get-65036@lists.php.net to get a copy of this message
hjalle Thu May 28 13:34:15 2009 UTC Modified files: /php-benchmarks/benchcli/misc timer.php Log: White spacce issues and removal of uneccessary function http://cvs.php.net/viewvc.cgi/php-benchmarks/benchcli/misc/timer.php?r1=1.1&r2=1.2&diff_format=u Index: php-benchmarks/benchcli/misc/timer.php diff -u php-benchmarks/benchcli/misc/timer.php:1.1 php-benchmarks/benchcli/misc/timer.php:1.2 --- php-benchmarks/benchcli/misc/timer.php:1.1 Sun May 24 19:01:24 2009 +++ php-benchmarks/benchcli/misc/timer.php Thu May 28 13:34:15 2009 @@ -1,35 +1,39 @@ <?php - /** * Simple timer class. */ +class Timer +{ + var $starttime; + var $elapsed; -class Timer{ - var $starttime; - var $elapsed; - - function __construct() - { - $this->starttime = 0; - $this->elapsed = 0; - } - function start() - { - $this->starttime = $this->_clock(); - $this->elapsed = 0; - } - function stop() - { - $this->elapsed = $this->_clock() - $this->starttime; - $this->starttime = 0; - } - function _clock() - { - $t = microtime(); - $t = explode(' ', $t); - $t = $t[1] + $t[0]; - return $t; - } + /** + * Constructor for the Timer class + */ + function Timer() + { + $this->starttime = 0; + $this->elapsed = 0; + } + /** + * Starts the timer. + * + * @return void + */ + function start() + { + $this->starttime = microtime(true); + $this->elapsed = 0; + } + /** + * Stops the timer. + * + * @return void + */ + function stop() + { + $this->elapsed = microtime(true) - $this->starttime; + $this->starttime = 0; + } } - ?> \ No newline at end of file

« previous php.qa (#65036) next »