ILLIXR: Illinois Extended Reality Testbed
|
Relative clock for all of ILLIXR. More...
#include <relative_clock.hpp>
Public Types | |
using | rep = _clock_rep |
using | period = _clock_period |
using | duration = _clock_duration |
Public Member Functions | |
time_point | now () const |
int64_t | absolute_ns (time_point relative) |
void | start () |
Starts the clock. All times are relative to this point. | |
bool | is_started () const |
Check if the clock is started. | |
time_point | start_time () const |
Get the start time of the clock. | |
Static Public Attributes | |
static constexpr bool | is_steady = true |
Relative clock for all of ILLIXR.
Please use this instead of std::chrono clocks; this way, you can fake real time without changing your code.
It also eliminates the class of bugs relating to using absolute time instead of time-since-start.
Unfortunately this can't satisfy Clock because it needs to have data (namely _m_start) shared across link-time boundaries. There's no clean way to do this with static variables, so instead I use instance variables and Phonebook.