6#include "roo_logging.h"
11#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
25 Time() : time_(std::nanf(
"")) {}
27 Time(
const roo_time::Duration& duration) : time_(duration.inSecondsFloat()) {}
42 bool isUnknown()
const {
return std::isnan(time_); }
76#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
78 std::string asString()
const;
82 String asArduinoString()
const;
90 explicit Time(
float time) : time_(time) {}
155roo_logging::Stream&
operator<<(roo_logging::Stream& os,
const Time& val);
Representation of elapsed, internally stored as floating-point seconds.
Time & operator/=(float div)
bool operator<=(const Time &other) const
float inMicroseconds() const
Returns the time in microseconds.
Time()
Creates a time object representing an 'unknown' time.
bool operator==(const Time &other) const
bool isUnknown() const
Returns whether the object represents an unknown time.
Time(const roo_time::Duration &duration)
Time & operator*=(float multi)
float inMilliseconds() const
Returns the time in milliseconds.
float inSeconds() const
Returns the time in seconds.
bool operator>=(const Time &other) const
friend Time TimeInSeconds(float)
Returns a time object equivalent to the specified time expressed in seconds.
Time & operator-=(const Time &other)
bool operator!=(const Time &other) const
friend Time UnknownTime()
Returns a time object representing an unknown time.
float inNanoseconds() const
Returns the time in nanoseconds.
Time & operator+=(const Time &other)
bool operator>(const Time &other) const
bool operator<(const Time &other) const
For convenience conversion from roo_time::Duration.
Time TimeInHours(float time)
Returns a time object equivalent to the specified time expressed in hours (3600 seconds).
Time TimeInNanoseconds(float time)
Returns a time object equivalent to the specified time expressed in nanoseconds.
roo_logging::Stream & operator<<(roo_logging::Stream &os, const Area &val)
Time TimeInMilliseconds(float time)
Returns a time object equivalent to the specified time expressed in milliseconds.
Time TimeInMicroseconds(float time)
Returns a time object equivalent to the specified time expressed in microseconds.
Area operator+(Area a, Area b)
Time TimeInSeconds(float time)
Returns a time object equivalent to the specified time expressed in seconds.
Area operator-(Area a, Area b)
Area operator/(Area a, float b)
Area operator*(Area a, float b)
Time UnknownTime()
Returns a time object representing an unknown time.
Time TimeInMinutes(float time)
Returns a time object equivalent to the specified time expressed in minutes (60 seconds).