green::Timer Class Reference

#include <Timer.h>

List of all members.

Public Member Functions

virtual ~Timer ()
 Timer ()
virtual void StartTiming ()
virtual void StopTiming ()
virtual bool IsTiming () const
virtual double GetStartTime () const
virtual double GetStopTime () const
virtual double GetTimeDelta () const

Static Public Member Functions

static double GetCurrentTime ()

Protected Attributes

bool mTiming
double mStartTime
double mStopTime


Detailed Description

The Timer class is a stopwatch mechanism that can also give you the current absolute time. Currently this is only implemented on posix environments.


Constructor & Destructor Documentation

virtual green::Timer::~Timer (  )  [inline, virtual]

Virtual destructor

green::Timer::Timer (  )  [inline]

Default constructor sets the Timer to not be timing, and startTime is set to 0.0


Member Function Documentation

static double green::Timer::GetCurrentTime (  )  [inline, static]

Get the current time NOTE: This isn't really the best way to do timing. The reason is that it is based off of wall clock time, which could change while the program is running (from a time server sync or from the user setting the time) which produces undefined results (potentially negative time deltas!). However, the Timer will at least ensure that there are no negative time deltas, and return a zero time delta in the above case.

Returns:
Returns the current time in seconds (with microsecond precision, supposedly).

virtual void green::Timer::StartTiming (  )  [inline, virtual]

Start timing. This sets a time marker from which GetTimeDelta is based.

virtual void green::Timer::StopTiming (  )  [inline, virtual]

Stop timing. You can still call GetTimeDelta() but it will return the delta between the start time and the stop time.

virtual bool green::Timer::IsTiming (  )  const [inline, virtual]

Check if the Timer is currently timing.

Returns:
Returns true if Timer is timing, false otherwise.

virtual double green::Timer::GetStartTime (  )  const [inline, virtual]

Get the start time (ie time when StartTiming was called)

Returns:
Returns the start time, in seconds, or zero if Timer was never started.

virtual double green::Timer::GetStopTime (  )  const [inline, virtual]

Get the stop time (ie the time when StopTiming was called)

Returns:
If Timer is currently timing, returns 0.0, otherwise returns the stop time.

virtual double green::Timer::GetTimeDelta (  )  const [inline, virtual]

Get the difference between the current time and the start time.

Returns:
If Timer is currently timing, returns the difference between the current time and the start time. Otherwise returns either the difference between the start and stop times, or 0.0, if Timer was never started.


The documentation for this class was generated from the following file:
Generated on Fri Apr 27 10:27:39 2007 for Green Engine by  doxygen 1.5.1