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 More...
 
void reset ()
 resets the clock More...
 
void setSpeed (float newSpeed)
 sets the speed factor of the clock More...
 
void start ()
 starts the clock More...
 
void step (IceUtil::Time stepSize)
 adds a timedelta to the current time More...
 
void stop ()
 stops the clock. More...
 
 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.

Definition at line 41 of file TimeKeeper.h.

Constructor & Destructor Documentation

◆ TimeKeeper()

Definition at line 29 of file TimeKeeper.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ getSpeed()

float getSpeed ( )

Definition at line 62 of file TimeKeeper.cpp.

+ Here is the caller graph for this function:

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

Definition at line 35 of file TimeKeeper.cpp.

+ Here is the caller graph for this function:

◆ reset()

void reset ( )

resets the clock

Definition at line 48 of file TimeKeeper.cpp.

+ Here is the caller graph for this function:

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

Definition at line 55 of file TimeKeeper.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ start()

void start ( )

starts the clock

Definition at line 67 of file TimeKeeper.cpp.

+ Here is the caller graph for this function:

◆ step()

void step ( IceUtil::Time  stepSize)

adds a timedelta to the current time

Parameters
stepSizehow much to add

Definition at line 85 of file TimeKeeper.cpp.

+ Here is the caller graph for this function:

◆ stop()

void stop ( )

stops the clock.

This does not reset the clock.

Definition at line 76 of file TimeKeeper.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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