Gumbo_Timer



Timer Class

Author(s): Michael Luster <mluster79@yahoo.com>
License:New BSD License
Copyright:Copyright (c) 2007, iBayou, Michael Luster
Link:http://sourceforge.net/projects/phpgumbo
Version:0.0.1

Implements interfaces:

Class Variables

bool $_running =  false [line 41]
bool $_stopped =  true [line 43]
array $_times = array () [line 38]

Class Methods

public Gumbo_Timer __construct ( [bool $start] ) [line 51]

Constructor

Parameter(s):

  • (bool) $start :: starts the Timer

[ Top ]
public num average ( [int $precision] ) [line 214]

Returns the average time between Laps

Parameter(s):

  • (int) $precision :: rounds the number to the given precision
  • precondition:  laps() >= 2
Implementation of:
Gumbo_Interface_Timer::average()

[ Top ]
public bool isRunning ( ) [line 278]

Returns if the Timer is running (or has been started)

Implementation of:
Gumbo_Interface_Timer::isRunning()

[ Top ]
public bool isStopped ( ) [line 286]

Returns if the Timer is stopped

Implementation of:
Gumbo_Interface_Timer::isStopped()

[ Top ]
public void lap ( ) [line 93]

Saves the Mark (or Lap)

  • precondition:  isRunning()
Implementation of:
Gumbo_Interface_Timer::lap()

[ Top ]
public int laps ( ) [line 254]

Returns the number of Laps

Implementation of:
Gumbo_Interface_Timer::laps()

[ Top ]
public void reset ( ) [line 118]

Resets the Timer

  • postcondition:  isStopped()
  • postcondition:  !isRunning()
Implementation of:
Gumbo_Interface_Timer::reset()

[ Top ]
public num stamp ( [int $lap] ) [line 132]

Returns the actual microtime value of the given lap (0 => start time)

Parameter(s):

  • (int) $lap :: (0 returns start time, if > laps() or negative, returns stop time)
Implementation of:
Gumbo_Interface_Timer::stamp()

[ Top ]
public void start ( [bool $reset] ) [line 64]

Starts the Timer by recording the current time stamp

Parameter(s):

  • (bool) $reset :: resets timer
  • precondition:  !isRunning()
  • postcondition:  isStarted()
Implementation of:
Gumbo_Interface_Timer::start()

[ Top ]
public num startTime ( ) [line 262]

Returns the start time

Implementation of:
Gumbo_Interface_Timer::startTime()

[ Top ]
public void stop ( ) [line 105]

Stops the Timer by recording the current time stamp

  • precondition:  isRunning()
  • postcondition:  isStopped()
Implementation of:
Gumbo_Interface_Timer::stop()

[ Top ]
public num stopTime ( ) [line 270]

Returns the stop time

Implementation of:
Gumbo_Interface_Timer::stopTime()

[ Top ]
public num time ( [int $lap], [int $precision] ) [line 166]

Returns the time difference from the given lap to the previous lap

If the parameter is null or 0, it will return the total time from start to stop recorded by the Timer. If parameter greater than total laps, it will return the difference from the Stop time to the previous lap.

Parameter(s):

  • (int) $lap :: lap number (if > laps(), returns last time)
  • (int) $precision :: rounds the number to the given precision
  • precondition:  laps() > 2
Implementation of:
Gumbo_Interface_Timer::time()

[ Top ]