|
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 () | |
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.
TimeKeeper | ( | ) |
float getSpeed | ( | ) |
IceUtil::Time getTime | ( | ) | const |
get the current time of this clock
Definition at line 35 of file TimeKeeper.cpp.
void reset | ( | ) |
resets the clock
Definition at line 48 of file TimeKeeper.cpp.
void setSpeed | ( | float | newSpeed | ) |
sets the speed factor of the clock
newSpeed | new 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.
void start | ( | ) |
starts the clock
Definition at line 67 of file TimeKeeper.cpp.
void step | ( | IceUtil::Time | stepSize | ) |
adds a timedelta to the current time
stepSize | how much to add |
Definition at line 85 of file TimeKeeper.cpp.
void stop | ( | ) |
stops the clock.
This does not reset the clock.
Definition at line 76 of file TimeKeeper.cpp.