#include <Pt/System/Clock.h>
Stopwatch, system time and monotonic ticks. More...
Inherits NonCopyable.
Public Member Functions | |
| Clock () | |
| Constructs a Clock. | |
| ~Clock () | |
| Destructor. | |
| void | start () |
| Start the clock. | |
| Timespan | stop () |
| Stop the clock. | |
Static Public Member Functions | |
| static DateTime | getSystemTime () |
| Returns the system time. | |
| static DateTime | getLocalTime () |
| Returns the current local time. | |
| static Timespan | getSystemTicks () |
| Returns the timespan since a fixed point in the past. | |
Clock measures elapsed time and reports the system clock. start() begins a measurement. stop() returns the Timespan since start(). A second start() begins a new measurement.
getSystemTime() returns the current UTC time as a DateTime. getLocalTime() returns the local wall time. These values follow the system clock, including adjustments.
getSystemTicks() returns the timespan since a fixed point in the past. That origin is platform-defined. It may be boot time or an epoch. Differences between two tick values are monotonic and are the right way to measure elapsed time across threads.
|
static |
This function retrieves the system ticks, which is the passed time since a fixed point in the past e.g. the system was started, or the unix epoch or some other fixed point in the past.