|
|
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 () | |
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.
| TimeKeeper | ( | ) |
| 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
| 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.
| void start | ( | ) |
starts the clock
| void step | ( | IceUtil::Time | stepSize | ) |
adds a timedelta to the current time
| stepSize | how much to add |
| void stop | ( | ) |
stops the clock.
This does not reset the clock.