Timer Class Reference

Timer class. More...

#include <timer.h>


Public Member Functions

 Timer ()
 Timer constructor.
void ResetTime ()
 Reset time zero position.
double GetDeltaTime ()
 Get time difference.
double GetDeltaTime (double max_fps)
 Get time difference with a lower limit by max fps.
double GetTime ()
 Get current time.

Private Attributes

double m_zero
double m_time


Detailed Description

Timer class.

A high performance timer for Windows and Linux.


Constructor & Destructor Documentation

Timer::Timer (  ) 

Timer constructor.

Reads the counter frequency if in Windows and resets time.


Member Function Documentation

void Timer::ResetTime (  ) 

Reset time zero position.

Set reference time to current time or counter value to be used when calculating time differences. This method is called from the constructor.

double Timer::GetDeltaTime (  ) 

Get time difference.

Reads the current time and return the difference since the last time this method was invoked. The first time it returns the time since the class was initilized or the last time ResetTime was invoked.

Returns:
Time difference in seconds.

double Timer::GetDeltaTime ( double  max_fps  ) 

Get time difference with a lower limit by max fps.

Reads the current time and return the difference since the last time this method was invoked, but if the deltatime is lower than 1/max_fps it will wait until that time is reached. The first time it uses the time since the class was initilized or the last time ResetTime was invoked as reference.

Parameters:
max_fps Maximal number of frames per second.
Returns:
Time difference in seconds.

double Timer::GetTime (  ) 

Get current time.

Reads the QueryPerformanceCounter if in Windows or uses gettimeofday to read current time. Then converts it to seconds.

Returns:
Current time in seconds.


Field Documentation

double Timer::m_zero [private]

Time defined as zero

double Timer::m_time [private]

Current time


The documentation for this class was generated from the following files:
Generated on Thu May 17 20:28:04 2007 for Ocean View by  doxygen 1.5.2