OSVR-Core
|
Functionality related to time and the OSVR_TimeValue abstraction. More...
Classes | |
class | TimeValueChronoConstRefWrapper |
Store a reference to const to a TimeValue for std::chrono interop. More... | |
class | TimeValueChronoValueWrapper |
Copy and store a TimeValue in a wrapper for std::chrono interop. More... | |
class | TimeValueClock |
Typedefs | |
typedef ::OSVR_TimeValue | TimeValue |
C++-friendly typedef for the OSVR_TimeValue structure. | |
using | time_value_period = std::micro |
Assumes the max representable resolution otherwise. | |
using | time_value_scalar_rep = std::uint64_t |
using | time_value_scalar_duration = std::chrono::duration< time_value_scalar_rep, time_value_period > |
using | time_value_seconds_duration = std::chrono::duration< OSVR_TimeValue_Seconds > |
Duration representation of the first element in the structure. | |
using | time_value_microseconds_duration = std::chrono::duration< OSVR_TimeValue_Microseconds, std::micro > |
Duration representation of the second element of the structure. | |
Functions | |
OSVR_ReturnCode | microsleep (OSVR_IN uint64_t microseconds) |
Request a thread sleep for at least the given number of microseconds. More... | |
void | getNow (TimeValue &tv) |
Set the given TimeValue to the current time. | |
TimeValue | getNow () |
Get a TimeValue for the current time. | |
double | duration (TimeValue const &a, TimeValue const &b) |
Get a double containing seconds between the time points. More... | |
std::string | toDecimalString (TimeValue tv) |
Converts to a precise decimal string. | |
osvr::util::time::TimeValue | getTimeValue (TimeValueClock::time_point const &tp) |
Get the TimeValue inside of a TimeValueClock time_point. | |
template<typename DerivedA , typename DerivedB > | |
time_value_scalar_duration | operator- (detail::TimeValueChronoWrapperBase< DerivedA > const &a, detail::TimeValueChronoWrapperBase< DerivedB > const &b) |
Subtract one wrapped TimeValue from another and get a std::duration back! More... | |
template<typename Derived > | |
time_value_scalar_duration | operator- (detail::TimeValueChronoWrapperBase< Derived > const &a, util::time::TimeValue const &b) |
subtraction: wrapped value and timevalue | |
template<typename Derived > | |
time_value_scalar_duration | operator- (util::time::TimeValue const &a, detail::TimeValueChronoWrapperBase< Derived > const &b) |
subtraction: timevalue and wrapped value | |
time_value_scalar_duration | operator- (TimeValueClock::time_point const &a, TimeValueClock::time_point const &b) |
Overloaded subtraction operator that returns a simple scalar duration. More... | |
template<typename Derived > | |
time_value_scalar_duration | operator- (TimeValueClock::time_point const &a, detail::TimeValueChronoWrapperBase< Derived > const &b) |
subtraction: time-point and wrapped value | |
template<typename Derived > | |
time_value_scalar_duration | operator- (detail::TimeValueChronoWrapperBase< Derived > const &a, TimeValueClock::time_point const &b) |
subtraction: wrapped value and time-point | |
time_value_scalar_duration | operator- (TimeValueClock::time_point const &a, util::time::TimeValue const &b) |
subtraction: time-point and timevalue | |
template<typename Derived > | |
time_value_scalar_duration | operator- (util::time::TimeValue const &a, TimeValueClock::time_point const &b) |
subtraction: timevalue and time-point | |
TimeValueClock::time_point | as_time_point (time::TimeValue const &tv) |
Treat/convert a TimeValue into a time point. | |
TimeValueClock::scalar_duration | to_duration (time::TimeValue const &tv) |
Convert a TimeValue into a scalar duration. | |
Functionality related to time and the OSVR_TimeValue abstraction.
Note that this is for C API-bordering areas. For purely C++ code, please use std::chrono for your time needs.
Get a double containing seconds between the time points.
|
inline |
Request a thread sleep for at least the given number of microseconds.
DO NOT use within a Sync plugin!
This is just a request for a minimum sleep time – operating system scheduling and sleep granularity means that you may end up sleeping for longer.
|
inline |
Subtract one wrapped TimeValue from another and get a std::duration back!
This is the main implementation: all overloads forward to this, generally via the wrap_time_value() overloaded functions that use theTimeValueChronoConstRefWrapper.
|
inline |
Overloaded subtraction operator that returns a simple scalar duration.
time-point and time-point