Nebula
Loading...
Searching...
No Matches
Posix::PosixTimer Class Reference

#include <posixtimer.h>

Detailed Description

Posix implementation of the Time::Timer class.

Under Posix, 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 (C) 2013-2018 Individual contributors, see AUTHORS file

Public Member Functions

 PosixTimer ()
 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

Timing::Time InternalTime () const
 return internal time
 
Timing::Time ToTime (const timespec &ts) const
 Convert timespec to Timing::Time.
 

Private Attributes

bool running
 
Timing::Time diffTime
 
Timing::Time stopTime
 

Constructor & Destructor Documentation

◆ PosixTimer()

Posix::PosixTimer::PosixTimer ( )

constructor

Member Function Documentation

◆ GetTicks()

Timing::Tick Posix::PosixTimer::GetTicks ( ) const

get current time in ticks

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

◆ GetTime()

Timing::Time Posix::PosixTimer::GetTime ( ) const

get current time in seconds

This returns the timer's current time in seconds.

◆ InternalTime()

Timing::Time Posix::PosixTimer::InternalTime ( ) const
private

return internal time

This returns the internal local time as large integer.

◆ Reset()

void Posix::PosixTimer::Reset ( )

reset the timer

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

◆ Running()

bool Posix::PosixTimer::Running ( ) const

return true if currently running

Returns true if the timer is currently running.

◆ Start()

void Posix::PosixTimer::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 Posix::PosixTimer::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.

◆ ToTime()

Timing::Time Posix::PosixTimer::ToTime ( const timespec & ts) const
private

Convert timespec to Timing::Time.

Member Data Documentation

◆ diffTime

Timing::Time Posix::PosixTimer::diffTime
private

◆ running

bool Posix::PosixTimer::running
private

◆ stopTime

Timing::Time Posix::PosixTimer::stopTime
private

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