note 90216 added to function.microtime

From: Date: Fri, 10 Apr 2009 18:35:29 +0000
Subject: note 90216 added to function.microtime
Groups: php.notes 
Request: Send a blank email to php-notes+get-153054@lists.php.net to get a copy of this message
class StopWatch { public $total; public $time; public function __construct() { $this->total = $this->time = microtime(true); } public function clock() { return -$this->time + ($this->time = microtime(true)); } public function elapsed() { return microtime(true) - $this->total; } public function reset() { $this->total=$this->time=microtime(true); } } $stopwatch = new StopWatch(); usleep(1000000); echo "Checkpoint 1: ".$stopwatch->clock()." seconds<br />"; usleep(1000000); echo "Checkpoint 2: ".$stopwatch->clock()." seconds<br />"; echo "Total Elapsed: ".$stopwatch->elapsed()." seconds<br />"; ---- Server IP: 209.41.74.194 Probable Submitter: 98.203.250.105 ---- Manual Page -- http://www.php.net/manual/en/function.microtime.php Edit -- https://master.php.net/note/edit/90216 Del: integrated -- https://master.php.net/note/delete/90216/integrated Del: useless -- https://master.php.net/note/delete/90216/useless Del: bad code -- https://master.php.net/note/delete/90216/bad+code Del: spam -- https://master.php.net/note/delete/90216/spam Del: non-english -- https://master.php.net/note/delete/90216/non-english Del: in docs -- https://master.php.net/note/delete/90216/in+docs Del: other reasons-- https://master.php.net/note/delete/90216 Reject -- https://master.php.net/note/reject/90216 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#153054) next »