38#include "blocxx/BLOCXX_config.h"
50 , m_start(getCurrentTime())
84template <
typename T,
typename U>
87 if (
y < (std::numeric_limits<T>::min)())
89 x = (std::numeric_limits<T>::min)();
91 else if (
y > (std::numeric_limits<T>::max)())
93 x = (std::numeric_limits<T>::max)();
97 x =
static_cast<T>(
y + 0.5);
138#ifdef BLOCXX_HAVE_STRUCT_TIMEVAL
159 else if (
temp.tv_sec ==
tv.tv_sec &&
temp.tv_usec <
tv.tv_usec)
161 tv.tv_usec =
temp.tv_usec;
184 tv.tv_usec =
diff.getMicrosecond();
220 seconds =
static_cast<double>(
diff.get()) + (
static_cast<double>(
diff.getMicrosecond()) / 1
e6);
286TimeoutTimer::asDWORDMs()
const
325#ifdef BLOCXX_HAVE_STRUCT_TIMESPEC
The DateTime class is an abstraction for date time data.
UInt32 getMicrosecond() const
Get the microsecond of the second for this DateTime object.
static DateTime getCurrent()
Gets a DateTime instance set to the current system time.
A timeout can be absolute, which means that it will happen at the specified DateTime.
DateTime getAbsolute() const
float getRelative() const
ETimeoutType getType() const
static Timeout relative(float seconds)
static Timeout absolute(const DateTime &dt)
TimeoutTimer(const Timeout &x)
bool expired() const
Indicates whether the last loop time has exceeded the timeout.
void start()
Meant to be called by timeout functions which loop.
void loop()
Meant to be called by timeout functions which loop, but don't want to reset the interval.
double calcSeconds() const
Timeout asRelativeTimeout() const
Timeout asTimeout() const
Timeout asAbsoluteTimeout() const
Converts the timer to an absolute timeout.
virtual DateTime getCurrentTime() const
void resetOnLoop()
Meant to be called by timeout functions which loop, and that want to reset the interval.
bool infinite() const
Indicates whether the timeout will never expire.
bool operator==(const Array< T > &x, const Array< T > &y)