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: 15 years ago
Size: 4,453 bytes


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                                                                                               |


 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.



  $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.


  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.


  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.


   Timer has already been started.

   Timer has already been stopped.

   Timer has not been started.

   Timer is already paused.

   Timer is not unpaused.