The Nebula Device 3: Win32::Win32Timer Class Reference

The Nebula Device 3

Win32::Win32Timer Class Reference

#include <win32timer.h>

Inheritance diagram for Win32::Win32Timer:

Timing::Timer


Detailed Description

Win32 implementation of the Time::Timer class. Under Win32, time measurement uses the QueryPerformanceCounter() methods.

Todo:
solve multiprocessor issues of QueryPerformanceCounter() (different processors may return different PerformanceFrequency values, thus, threads should be prevented from switching between processors with thread affinities).
(C) 2006 Radon Labs GmbH

Public Member Functions

 Win32Timer ()
 constructor
void Start ()
 start/continue the timer
void Stop ()
 stop the timer
void Reset ()
 reset the timer
bool Running () const
 return true if currently running
Timing::Time GetTime () const
 get current time in seconds
uint GetTicks () const
 get current time in ticks

Member Function Documentation

void Win32::Win32Timer::Start (  ) 

start/continue the timer

Start the timer. This will update the diffTime member to reflect the accumulated time when the timer was not running (basically the difference between this timer's time and the real system time).

void Win32::Win32Timer::Stop (  ) 

stop the timer

Stop the timer. This will record the current realtime, so that the next Start() can measure the time lost between Stop() and Start() which must be taken into account to keep track of the difference between this timer's time and realtime.

void Win32::Win32Timer::Reset (  ) 

reset the timer

Reset the timer so that will start counting at zero again.

bool Win32::Win32Timer::Running (  )  const

return true if currently running

Returns true if the timer is currently running.

Timing::Time Win32::Win32Timer::GetTime (  )  const

get current time in seconds

This returns the timer's current time in seconds.

uint Win32::Win32Timer::GetTicks (  )  const

get current time in ticks

This returns the timer's current time in "ticks".