MRPT
2.0.4
|
Clock that is compatible with MRPT TTimeStamp representation.
#include <mrpt/core/Clock.h>
Public Types | |
enum | Source { Realtime = 0, Monotonic } |
Options for setting the source of all timestamps across MRPT: setActiveClock(), now() More... | |
using | rep = int64_t |
using | period = std::ratio< 1, 10000000 > |
using | duration = std::chrono::duration< rep, period > |
using | time_point = std::chrono::time_point< Clock > |
Static Public Member Functions | |
static time_point | now () noexcept |
Returns the current time using the currently selected Clock source. More... | |
static time_point | fromDouble (const double t) noexcept |
Create a timestamp from its double representation. More... | |
static double | toDouble (const time_point t) noexcept |
Converts a timestamp to a UNIX time_t-like number, with fractional part. More... | |
static void | setActiveClock (const Source s) |
Changes the selected clock to get time from when calling now(). More... | |
static Source | getActiveClock () |
Returns the currently selected clock. More... | |
static int64_t | resetMonotonicToRealTimeEpoch () noexcept |
Monotonic clock might drift over time with respect to Realtime. More... | |
static uint64_t | getMonotonicToRealtimeOffset () |
Returns the number of nanoseconds that are added to the output of the POSIX CLOCK_MONOTONIC to make timestamps match the epoch of POSIX CLOCK_REALTIME . More... | |
Static Public Attributes | |
static constexpr bool | is_steady = std::chrono::system_clock::is_steady |
using mrpt::Clock::duration = std::chrono::duration<rep, period> |
using mrpt::Clock::period = std::ratio<1, 10000000> |
using mrpt::Clock::rep = int64_t |
using mrpt::Clock::time_point = std::chrono::time_point<Clock> |
enum mrpt::Clock::Source |
Options for setting the source of all timestamps across MRPT: setActiveClock(), now()
|
staticnoexcept |
Create a timestamp from its double representation.
Definition at line 99 of file Clock.cpp.
Referenced by mrpt::apps::MonteCarloLocalization_Base::prepareGT(), mrpt::graphslam::CGraphSlamEngine< GRAPH_T >::readGTFile(), mrpt::graphslam::CGraphSlamEngine< GRAPH_T >::readGTFileRGBD_TUM(), TEST(), and mrpt::system::time_tToTimestamp().
|
static |
Returns the currently selected clock.
Definition at line 122 of file Clock.cpp.
References selectedClock.
|
static |
Returns the number of nanoseconds that are added to the output of the POSIX CLOCK_MONOTONIC
to make timestamps match the epoch of POSIX CLOCK_REALTIME
.
Definition at line 158 of file Clock.cpp.
References m2r_epoch, monotonic_epoch_init, resetMonotonicToRealTimeEpoch(), and MonotonicToRealtimeEpoch::rt2mono_diff.
|
staticnoexcept |
Returns the current time using the currently selected Clock source.
Definition at line 94 of file Clock.cpp.
References getCurrentTime().
Referenced by mrpt::system::CTimeLoggerEntry::CTimeLoggerEntry(), mrpt::opengl::COpenGLBuffer::RAII_Impl::destroy(), mrpt::apps::RawlogGrabberApp::dump_verbose_info(), mrpt::system::getCurrentTime(), mrpt::hwdrivers::CMyntEyeCamera::getObservation(), mrpt::apps::ICP_SLAM_App_Live::impl_get_next_observations(), mrpt::slam::CMetricMapBuilderICP::initialize(), mrpt::system::now(), mrpt::system::CTimeLoggerEntry::stop(), TEST(), and test_delay().
|
staticnoexcept |
Monotonic clock might drift over time with respect to Realtime.
The first time a time is requested to now() with Monotonic clock enabled, MRPT internally saves the current values of both, Realtime and Monotonic clocks, then use the difference in all subsequent calls to set Monotonic timepoints in the same epoch than Realtime.
By explicitly calling this static method, a user is able to force a resynchrnization between the two clocks. Potentially useful for systems that run for very long periods of time without interruption.
Definition at line 124 of file Clock.cpp.
References m2r_epoch, monotonic_epoch_init, MonotonicToRealtimeEpoch::monotonic_ns, MonotonicToRealtimeEpoch::realtime_ns, and MonotonicToRealtimeEpoch::rt2mono_diff.
Referenced by getCurrentTime(), getMonotonicToRealtimeOffset(), and TEST().
|
static |
|
staticnoexcept |
Converts a timestamp to a UNIX time_t-like number, with fractional part.
Definition at line 106 of file Clock.cpp.
Referenced by mrpt::opengl::COpenGLBuffer::RAII_Impl::destroy(), mrpt::obs::CObservation::getDescriptionAsText(), mrpt::apps::RBPF_SLAM_App_Base::run(), TEST(), test_delay(), and mrpt::system::timestampTotime_t().
Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020 |