9 # define _QI_CLOCK_HPP_
13 # include <boost/chrono/chrono.hpp>
19 template<
class Rep,
class Ratio>
22 template<
class ClockType>
23 using TimePoint = boost::chrono::time_point<ClockType>;
45 using rep = Duration::rep;
59 BOOST_STATIC_CONSTEXPR
bool is_steady = boost::chrono::steady_clock::is_steady;
73 static time_point now();
88 using rep = Duration::rep;
102 BOOST_STATIC_CONSTEXPR
bool is_steady = boost::chrono::steady_clock::is_steady;
113 static time_point now();
123 static uint32_t toUint32ms(
const time_point &t)
throw();
132 static int32_t toInt32ms(
const time_point &t)
throw();
153 static time_point fromUint32ms(
uint32_t t_ms, time_point guess,
154 Expect expect=Expect_SoonerOrLater) throw();
156 static time_point fromInt32ms(
int32_t t_ms, time_point guess,
157 Expect expect=Expect_SoonerOrLater) throw();
170 using rep = Duration::rep;
182 BOOST_STATIC_CONSTEXPR
bool is_steady =
false;
197 static std::time_t to_time_t(
const time_point& t)
throw();
205 static time_point from_time_t(
const std::time_t &t)
throw();
233 template <
class Rep,
class Period>
234 inline void sleepFor(
const DurationType<Rep, Period>& d);
242 template <
class Duration>
243 inline void sleepUntil(
const boost::chrono::time_point<SteadyClock, Duration>& t);
249 template <
class Duration>
250 inline void sleepUntil(
const boost::chrono::time_point<Clock, Duration>& t);
260 template <
class Duration>
261 inline void sleepUntil(
const boost::chrono::time_point<SystemClock, Duration>& t);
277 template <
class DurationTo,
class TimePo
intFrom>
281 template <
class R,
class P>
282 inline std::string
to_string(
const DurationType<R, P> &d);
284 template <
class C,
class D>
285 inline std::string
to_string(
const boost::chrono::time_point<C, D> &t);
290 template class QI_API boost::chrono::duration<int64_t, boost::nano>;
291 template class QI_API boost::chrono::duration<int64_t, boost::micro>;
292 template class QI_API boost::chrono::duration<int64_t, boost::milli>;
293 template class QI_API boost::chrono::duration<int64_t>;
294 template class QI_API boost::chrono::duration<int64_t, boost::ratio<60> >;
295 template class QI_API boost::chrono::duration<int64_t, boost::ratio<3600> >;
296 template class QI_API boost::chrono::time_point<qi::SteadyClock>;
297 template class QI_API boost::chrono::time_point<qi::SystemClock>;
302 #endif // _QI_OS_HPP_
DurationTo durationSince(const TimePointFrom &t)
}@
DurationType< int64_t, boost::micro > MicroSeconds
Duration::rep rep
The representation type of the duration and time_point.
Result is expected to be later than user-provided reference.
Duration::period period
The tick period of the clock in nanoseconds.
SteadyClock::time_point SteadyClockTimePoint
Steady clock time point.
Duration duration
The duration type of the clock.
void sleepFor(const qi::Duration &d)
The SystemClock class represents the system-wide real time wall clock. It may not be monotonic: on mo...
TimePoint< SteadyClock > time_point
Duration duration
The duration type of the clock.
Expect
Enum expected argument.
DurationType< int64_t, boost::ratio< 3600 >> Hours
std::string to_string(const DurationType< R, P > &d)
Duration::rep rep
The representation type of the duration and time_point.
DurationType< int64_t, boost::ratio< 60 >> Minutes
dll import/export and compiler message
Result is expected to be later than user-provided reference.
std::string toISO8601String(const SystemClockTimePoint &t)
Return the date and time as a string in ISO 8601 format. The time is given up to millisecond precisio...
Duration duration
The duration type of the clock.
DurationType< int64_t, boost::nano > NanoSeconds
QI_API_DEPRECATED typedef SystemClock WallClock
SystemClock::time_point SystemClockTimePoint
System clock time point.
The SteadyClock class represents a monotonic clock. <includename>qi/clock.hpp</includename> ...
DurationType< int64_t, boost::milli > MilliSeconds
QI_API_DEPRECATED SystemClockTimePoint wallClockNow()
Returns a time_point representing the current value of the clock.
QI_API_DEPRECATED SteadyClockTimePoint steadyClockNow()
Returns a time_point representing the current value of the clock.
Duration::rep rep
The representation type of the duration and time_point.
Pick the nearest result to user-provided reference.
QI_API_DEPRECATED typedef time_point WallClockTimePoint
Duration::period period
The tick period of the clock in nanoseconds.
Duration::period period
The tick period of the clock in nanoseconds.
Clock::time_point ClockTimePoint
qi::Clock time point.
QI_API_DEPRECATED typedef SystemClockTimePoint WallClockTimePoint
System clock time point.
Expect
Enum expected argument.
static time_point now()
Returns a time_point representing the current value of the clock.
QI_API_DEPRECATED typedef time_point SteadyClockTimePoint
void sleepUntil(const SteadyClockTimePoint &t)
Blocks the execution of the current thread until t has been reached.
boost::chrono::time_point< Clock > time_point
DurationType< int64_t, boost::ratio< 1 >> Seconds
boost::chrono::time_point< SystemClock > time_point
boost::chrono::time_point< ClockType > TimePoint
static time_point now()
Returns a time_point representing the current value of the clock.
#define QI_API_DEPRECATED
Compiler flags to mark a function as deprecated. It will generate a compiler warning.
boost::chrono::duration< Rep, Ratio > DurationType
Convenience typedefs.
The Clock class represents a system-wide clock, best suitable for timestamping events. Typically monotonic and unaffected by the system clock adjustment, altough this is not guaranteed.
Pick the nearest result to user-provided reference.