Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages

Timer Class Reference

#include <timer.h>

List of all members.


Detailed Description

Timer class Used to get delta time between two moments. The timer class abstracts away OS specific implementations and gives you a single interface for timing across all supported platforms. The timer is reset when you first create it, an successive calls to GetDeltaTime() will return the deltatime passed between the calls. If you do not wish to reset the timer when querying for the deltatime, you pass false as argument to GetDeltaTime The timer also has a static heartbeat counter that can be used to synchronize unrelated objects in the game. The heartbeat is reset on application startup and increases as it executes. Use the heartbeat divisor to get the factor of increase.

Author:
Mattias Jansson (mattias@realityrift.com)
Todo:
Look into RTC implementation for Linux targets


Public Member Functions

 Timer ()
float GetDeltaTime (bool bReset=true)
void Reset ()

Static Public Member Functions

uint64_t GetHeartbeat ()
uint64_t GetHeartbeatDivisor ()

Protected Attributes

uint64_t m_uliOldClock

Static Protected Attributes

uint64_t s_uliOldHeartbeatClock
uint64_t s_uliHeartbeat
uint64_t s_uliDivisor


Constructor & Destructor Documentation

Timer  ) 
 


Member Function Documentation

float GetDeltaTime bool  bReset = true  ) 
 

Parameters:
bReset Reset timer if true
Returns:
Time passed in seconds since last call to Reset() or GetDeltaTime(true)

void Reset  ) 
 

Reset timer

uint64_t GetHeartbeat  )  [static]
 

Returns:
Heartbeat

uint64_t GetHeartbeatDivisor  )  [static]
 

Returns:
Heartbeat divisor


Member Data Documentation

uint64_t m_uliOldClock [protected]
 

Old clock

uint64_t s_uliOldHeartbeatClock [static, protected]
 

Old heartbeat clock

uint64_t s_uliHeartbeat [static, protected]
 

Heartbeat is updated periodically and is used to maintain sync between different sections of the engine

uint64_t s_uliDivisor [static, protected]
 

The divisor is the factor by which you convert heartbeats to seconds. Multiply heartbeat with divisor


The documentation for this class was generated from the following file:
Generated on Wed Jan 21 14:21:16 2004 for NeoEngine by doxygen 1.3.5