Changeset 42 for trunk/lib/ScriptTimer.inc.php
- Timestamp:
- Dec 18, 2005 12:16:03 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/ScriptTimer.inc.php
r41 r42 1 1 <?php 2 2 /** 3 * ScriptTimer.inc.php 3 * ScriptTimer.inc.php 4 4 * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information 5 5 */ 6 6 7 7 class ScriptTimer { 8 8 … … 10 10 var $_timing_start_times; 11 11 var $_timing_stop_times; 12 12 13 13 function start($name='default') 14 14 { 15 15 $this->_timing_start_times[$name] = explode(' ', microtime()); 16 16 } 17 17 18 18 function stop($name='default') 19 19 { 20 20 $this->_timing_stop_times[$name] = explode(' ', microtime()); 21 21 } 22 22 23 23 function getTime($name='default') 24 24 { … … 26 26 return 0; 27 27 } 28 28 29 29 if (!isset($this->_timing_stop_times[$name])) { 30 30 $stop_time = explode(' ', microtime()); … … 32 32 $stop_time = $this->_timing_stop_times[$name]; 33 33 } 34 34 35 35 // Do the big numbers first so the small ones aren't lost. 36 36 $current = $stop_time[1] - $this->_timing_start_times[$name][1]; 37 37 $current += $stop_time[0] - $this->_timing_start_times[$name][0]; 38 38 39 39 return sprintf($this->time_format, $current); 40 40 }
Note: See TracChangeset
for help on using the changeset viewer.