PHP Classes

File: readme.txt

Recommend this page to a friend!
  Classes of John Jimenez   Deathead's Timer   readme.txt   Download  
File: readme.txt
Role: ???
Content type: text/plain
Description: ReadMe With Usage Notes
Class: Deathead's Timer
Author: By
Last change:
Date: 22 years ago
Size: 4,453 bytes
 

Contents

Class file image Download
+--------------------------------------------------------------------------------------------------------------+ | ReadMe | +--------------------------------------------------------------------------------------------------------------+ | Written by: Jay Jimenez | | | | For best results printing this document, set your printer font to Courier New, Regular, 8pts with the page | | margins set to 0.50 on all sides. For best results viewing this document, change your screen resolution to | | 1280x1024, and set your text editor's font to Courier, Regular, 12pts with the wrod wrap column set to 112 | +--------------------------------------------------------------------------------------------------------------+ | | | Script: | | Deathead's Timer Class | | Script Programmer: | | Jay Jimenez | +--------------------------------------------------------------------------------------------------------------+ Description: A small class used to track the amount of time spent inside a php script. The script comes complete with start, stop, pause, unpause, and rest functions to completely control the timer. You are also able to get a "running time" without stopping the timer. This class is very user-friendly and offer it's own error system. Usage: Constructor: $objName = new timer([auto_start]); Pass any true value and the script will automatically start the timer, otherwise the timer will wait until the start() function is called. Functions void $objName->start(); If you did not auto-start the timer you must call the start() function to start timing: float $objName->get(); Once the timer is started you can get the "running time" with a simple call to get(). This is also the function used to return the time once you have called the stop() function. This function returns negative one (-1) on error int $objName->stop(); To stop the timer simply call the stop() function. This will return a false value on error. Once the timer is stopped there is no starting it back up; see pause(). int $objName->pause(); To pause the timer, call the pause() function. This will return a false value on error. Once the timer is paused you can unpause it later for further timing. int $objName->unpause(); To unpause the timer, call the unpause() function. This will return a false value on error. Once the timer is unpaused you can pause it again later. void $objName->reset(); To reset the timer, call the reset() function. This will permanently clear all timer information. Variables float $objName->strt This is the microtime that the timer was started. float $objName->stp This is the microtime that the timer was stopped. array $objName->paus Array of microtimes that the timer was paused. array $objName->unpaus Array of microtimes that the script was unpaused. float $objName->final Calculated time that the timer was running. This is set only after the call to $objName->stop(). The calculation is as follows: ($objName->stp - $objName->strt) - ($objName->unpaus[n] - $objName->paus[n]). If the timer was paused but not unpaused before the stop() call, the final pause time is subtracted from the stop time. string $objName->errno Returns the error number of the last error. string $objName->errmsg Returns the error message of the last error. Errors 01 Timer has already been started. 02 Timer has already been stopped. 03 Timer has not been started. 04 Timer is already paused. 05 Timer is not unpaused.