getMonotonicNanosecondsSinceUnixEpoch#
Fully qualified name: carb::time::getMonotonicNanosecondsSinceUnixEpoch
Defined in carb/time/Util.h
- inline std::chrono::nanoseconds carb::time::getMonotonicNanosecondsSinceUnixEpoch(
Retrieves the approximate monotonic time in nanoseconds since the Unix epoch.
Note
If the system wall clock time is incorrect on the first call, the results from this function will continue to be incorrect for the remainder of the process. All of the returned times will still be somewhat accurate relative to the steady clock epoch (usually system boot time).
Note
All clocks drift. The system wall clock time is periodically corrected through NTP updates because of this. However, the monotonic clocks do not get such updates and any drift that occurs in them will be permanent for the session and accumulate in timing results.
- Returns:
The approximate current time in nanoseconds. This will always be relative to the Unix epoch (midnight January 1, 1970) but is not guaranteed to be accurate since it would not be subject to wall clock time corrections. All the returned timestamps will be monotonically increasing, but will likely drift especially over very long sessions.