TimeKeeper Class Reference

The TimeKeeper class tracks the passing of time and allows to stop it, restart it, and adjust its speed (only used by ArmarXTimeServer). More...

#include <ArmarXCore/core/time/TimeKeeper.h>

Public Member Functions

float getSpeed ()
 
IceUtil::Time getTime () const
 get the current time of this clock
 
void reset ()
 resets the clock
 
void setSpeed (float newSpeed)
 sets the speed factor of the clock
 
void start ()
 starts the clock
 
void step (IceUtil::Time stepSize)
 adds a timedelta to the current time
 
void stop ()
 stops the clock.
 
 TimeKeeper ()
 

Detailed Description

The TimeKeeper class tracks the passing of time and allows to stop it, restart it, and adjust its speed (only used by ArmarXTimeServer).

Internally the current time is represented as a combination of start time, speed and an offset. The current time (i.e. the output of getTime()) is always (IceUtil::Time::now() - startTime) * speed + offset. When the timer is paused and unpaused or the speed changes, offset gets increased by (IceUtil::Time::now() - starttime) * speed and starttime gets reset to the current time.

Constructor & Destructor Documentation

◆ TimeKeeper()

Member Function Documentation

◆ getSpeed()

float getSpeed ( )

◆ getTime()

IceUtil::Time getTime ( ) const

get the current time of this clock

Returns
the current time. In most cases this should be interpreted as a timedelta, not a datetime.

◆ reset()

void reset ( )

resets the clock

◆ setSpeed()

void setSpeed ( float newSpeed)

sets the speed factor of the clock

Parameters
newSpeednew speed factor

Sets how fast the clock is running. e.g. a value of 0.5 means that the clock only ticks with half the speed of the system clock.

◆ start()

void start ( )

starts the clock

◆ step()

void step ( IceUtil::Time stepSize)

adds a timedelta to the current time

Parameters
stepSizehow much to add

◆ stop()

void stop ( )

stops the clock.

This does not reset the clock.


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