|
Clock to get date/time from a specific clock type or wait for certain durations or until certain date/times in a given clock. More...
#include <ArmarXCore/core/time/Clock.h>
Public Member Functions | |
Clock (ClockType clockType=ClockType::Virtual) | |
Constructs a new clock of given clock type (virtual by default). More... | |
DateTime | now () const |
Current date/time of the clock. More... | |
void | waitFor (const Duration &duration) const |
Wait for a certain duration. More... | |
Duration | waitUntil (const DateTime &dateTime) const |
Wait and block until the given date/time is surpassed. More... | |
Static Public Member Functions | |
static DateTime | Now () |
Current time on the virtual clock. More... | |
static void | WaitFor (const Duration &duration) |
Wait for a certain duration on the virtual clock. More... | |
static Duration | WaitUntil (const DateTime &dateTime) |
Wait and block until the given date/time is surpassed on the virtual clock. More... | |
Clock to get date/time from a specific clock type or wait for certain durations or until certain date/times in a given clock.
In most cases, using the virtual clock is the desired behaviour. The virtual clock reports the current time according to the configured time server, or (as a fallback) the operating systems real time clock. The virtual clock can be accessed through the static methods of this clock.
For other cases, i.e., where the actual operating system real time clock is needed (ClockType::Realtime), or a monotonic clock is required (ClockType::Monotonic), a clock with the needed clock type as constructor parameter can be instantiated. The API is then similar to those of the virtual clock using the corresponding non-static member functions.
Clock | ( | ClockType | clockType = ClockType::Virtual | ) |
|
static |
DateTime now | ( | ) | const |
|
static |
void waitFor | ( | const Duration & | duration | ) | const |