Time Class Reference

Description

Manages all time related functionality.

Note
Sim thread only unless where specified otherwise.

Inherits Module< Time >.

Methods

float getTime () const
 Gets the time elapsed since application start. More...
 
UINT64 getTimeMs () const
 Gets the time elapsed since application start. More...
 
float getFrameDelta () const
 Gets the time since last frame was executed. More...
 
UINT64 getFrameIdx () const
 Returns the sequential index of the current frame. More...
 
UINT64 getTimePrecise () const
 Returns the precise time since application start, in microseconds. More...
 
UINT64 getStartTimeMs () const
 Gets the time at which the application was started, counting from system start. More...
 
Internal
void _update ()
 Called every frame. More...
 

Static fields

static const double MICROSEC_TO_SEC
 Multiply with time in microseconds to get a time in seconds. More...
 

Additional Inherited Members

- Static methods inherited from Module< Time >
static Timeinstance ()
 Returns a reference to the module instance. More...
 
static TimeinstancePtr ()
 Returns a pointer to the module instance. More...
 
static void startUp (Args &&...args)
 Constructs and starts the module using the specified parameters. More...
 
static void startUp (Args &&...args)
 Constructs and starts a specialized type of the module. More...
 
static void shutDown ()
 Shuts down this module and frees any resources it is using. More...
 
static bool isStarted ()
 Query if the module has been started. More...
 

Method documentation

void _update ( )

Called every frame.

Should only be called by Application.

float getFrameDelta ( ) const

Gets the time since last frame was executed.

Only gets updated once per frame.

Returns
Time since last frame was executed, in seconds.
UINT64 getFrameIdx ( ) const

Returns the sequential index of the current frame.

First frame is 0.

Returns
The current frame.
Note
Thread safe, but only counts sim thread frames.
UINT64 getStartTimeMs ( ) const

Gets the time at which the application was started, counting from system start.

Returns
The time since system to application start, in milliseconds.
float getTime ( ) const

Gets the time elapsed since application start.

Only gets updated once per frame.

Returns
The time since application start, in seconds.
UINT64 getTimeMs ( ) const

Gets the time elapsed since application start.

Only gets updated once per frame.

Returns
The time since application start, in miliseconds.
UINT64 getTimePrecise ( ) const

Returns the precise time since application start, in microseconds.

Unlike other time methods this is not only updated every frame, but will return exact time at the moment it is called.

Returns
Time in microseconds.
Note
You will generally only want to use this for performance measurements and similar. Use non-precise methods in majority of code as it is useful to keep the time value equal in all methods during a single frame.

Member Data Documentation

const double MICROSEC_TO_SEC
static

Multiply with time in microseconds to get a time in seconds.