ADTF  v2.14.3
cHighResTimer Class Reference

High resolution timer. More...

Public Member Functions

 cHighResTimer ()
 Default constructor.
 
virtual ~cHighResTimer ()
 Destructor.
 
tResult Create (tUInt uiDelay)
 Allocates all resources, registers timer with OS. More...
 
tResult Release ()
 Releases all allocated resources. More...
 
tVoid Sleep (tUInt uiTimeout)
 Pauses the calling thread for a specified time. More...
 
tVoid SleepMicroSeconds (tTimeStamp tmTimeout)
 Pauses the calling thread for a specified time. More...
 

Static Public Member Functions

static tTimeStamp GetTime ()
 Returns the current time in microseconds. More...
 
static tUInt GetMinimumResolution ()
 returns the minimum resolution More...
 
static tUInt GetMaximumResolution ()
 returns the maximum resolution More...
 

Detailed Description

High resolution timer.

Provides a better resolution than the standard system timer. Warning: This class is not shared between different objects files and no reference time, therefore the time is not synchronized between different plugins. Be sure to use IReferenceClock instead, when you need a synchronized time. Important for Windows: cHighResTimer is NOT thread safe

Definition at line 30 of file highrestimer.h.

Member Function Documentation

tResult Create ( tUInt  uiDelay)

Allocates all resources, registers timer with OS.

Parameters
uiDelay[in] The initial delay before the timer will call its handling function, thus the minimum delay before the first Sleep() returns. Must be at least 1.
Returns
ERR_NOERROR if all went well @ [Windows] ERR_INVALID_ARG if timer was not initialized
static tUInt GetMaximumResolution ( )
static

returns the maximum resolution

Returns
maximum resolution
Return values
0error case
Attention
only implemented on win32 platforms. on other platforms the default return value is 0
static tUInt GetMinimumResolution ( )
static

returns the minimum resolution

Returns
minimum resolution
Return values
0error case
Attention
only implemented on win32 platforms. on other platforms the default return value is 0
static tTimeStamp GetTime ( )
static

Returns the current time in microseconds.

This function will get the high precision time of the cpu frequency ticks.

Returns
The current time in microseconds.
This method is real-time safe.
See The ADTF Real-Time Extension.
tResult Release ( )

Releases all allocated resources.

Returns
[Windows]ERR_NOT_INITIALISED if timer was not initialized.
ERR_NOERROR if all went well.
tVoid Sleep ( tUInt  uiTimeout)

Pauses the calling thread for a specified time.

Remarks
the highresolution time needs to be initialised by calling Create() first, otherwise this function will do nothing.
Parameters
uiTimeout[in] The time to sleep in milliseconds.
Returns
void
tVoid SleepMicroSeconds ( tTimeStamp  tmTimeout)

Pauses the calling thread for a specified time.

Remarks
the highresolution time needs to be initialised by calling Create() first, otherwise this function will do nothing. Since windows doesn't know any method to sleep just some micro seconds the interval is converted to milliseconds and Sleep() is called.
Parameters
tmTimeout[in] The time to sleep in microsecondsseconds.
Returns
void

Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Fri Mar 22 2019 by doxygen 1.8.10)