Nebula
Loading...
Searching...
No Matches
Win32::Win32Timer Class Reference

#include <win32timer.h>

Detailed Description

Win32 implementation of the Time::Timer class.

Uses the QueryPerformanceCounter() functions.

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).

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
 
Timing::Tick GetTicks () const
 get current time in ticks
 

Private Member Functions

__int64 InternalTime () const
 return internal time as 64 bit integer
 

Private Attributes

bool running
 
__int64 diffTime
 
__int64 stopTime
 

Constructor & Destructor Documentation

◆ Win32Timer()

Win32::Win32Timer::Win32Timer ( )

constructor

Member Function Documentation

◆ GetTicks()

Timing::Tick Win32::Win32Timer::GetTicks ( ) const

get current time in ticks

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

A tick is defined as one millisecond (1/1000 seconds).

◆ GetTime()

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

get current time in seconds

This returns the timer's current time in seconds.

◆ InternalTime()

__int64 Win32::Win32Timer::InternalTime ( ) const
private

return internal time as 64 bit integer

This returns the internal local time as large integer.

◆ Reset()

void Win32::Win32Timer::Reset ( )

reset the timer

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

◆ Running()

bool Win32::Win32Timer::Running ( ) const

return true if currently running

Returns true if the timer is currently running.

◆ Start()

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).

◆ Stop()

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.

Member Data Documentation

◆ diffTime

__int64 Win32::Win32Timer::diffTime
private

◆ running

bool Win32::Win32Timer::running
private

◆ stopTime

__int64 Win32::Win32Timer::stopTime
private

The documentation for this class was generated from the following files: