Class microtimer

Description

The microtimer class A generic microtimer. This timer allows elapsed times to be measured down to microseconds in theory, although depending on how 'real-time' the OS is, there may well be limitations.

The microtimer works like a stopwatch. It is either ticking or it is stopped. It has a number of seconds on the clock at any one instant. It may be started, stopped or read.

Located in /timer-defs.php (line 39)


	
			
Variable Summary
 mixed $reference
 mixed $seconds
 mixed $ticking
Method Summary
 microtimer microtimer ()
 string formatted_secs ()
 string formatted_time ()
 float microsecs ()
 float millisecs ()
 void reset ()
 void restart ()
 float secs ()
 void start ()
 void stop ()
Variables
mixed $reference = 0 (line 49)

Reference time to base elapsed interval on

mixed $seconds = 0 (line 42)

Current number of seconds on the timer

mixed $ticking = false (line 44)

True if the timer is ticking

Methods
Constructor microtimer (line 55)

Constructor Create a new microtimer.

microtimer microtimer ()
formatted_microsecs (line 186)

Return the micro-seconds on the clock to 2 decimal places.

Note that this is a numeric string which includes commas for the thousands. It is therefore not a float suitable for arithmetic.

  • return: Formatted number: micro-seconds on the clock to 2 decimal places.
string formatted_microsecs ()
formatted_millisecs (line 175)

Return the milli-seconds on the clock to 2 decimal places.

Note that this is a numeric string which includes commas for the thousands. It is therefore not a float suitable for arithmetic.

  • return: Formatted number: milli-seconds on the clock to 2 decimal places.
string formatted_millisecs ()
formatted_secs (line 164)

Return the seconds on the clock to 2 decimal places.

Note that this is a numeric string which includes commas for the thousands. It is therefore not a float suitable for arithmetic.

  • return: Formatted number: seconds on the clock to 2 decimal places.
string formatted_secs ()
formatted_time (line 153)

Return the time on the clock in a nice 'human' format. This is in the form of a string, viz: '14d 2h 12m 13s'.

  • return: The time on the clock in 'human' format.
string formatted_time ()
microsecs (line 143)

Returns the micro-seconds on the clock.

  • return: Micro-seconds on the clock at the time of this call.
float microsecs ()
millisecs (line 134)

Returns the milli-seconds on the clock.

  • return: Milli-seconds on the clock at the time of this call.
float millisecs ()
reset (line 106)

Reset the timer. This zeroes the timer. If it was ticking it goes on ticking, but starting from zero.

void reset ()
restart (line 116)

Restart the timer. This zeroes the timer and then starts it. Has same effect as reset() but also makes sure the timer is ticking after resetting internal timer values.

void restart ()
secs (line 125)

Returns the seconds on the clock as a floating point number.

  • return: Seconds on the clock at the time of this call.
float secs ()
start (line 87)

Start the timer. Starts the timer ticking. If it was already ticking then there is no change in status.

void start ()
stop (line 97)

Stop the timer This freezes the internal seconds value, and stops the timer from ticking.

void stop ()

Documentation generated by phpDocumentor 1.3.0RC3