6void TimeToString(Time val,
char* out,
int maxlen) {
8 strncpy(out,
"? s", maxlen);
11 const char* sign =
"";
13 if (val.inSeconds() == 0.0f) {
14 snprintf(out, maxlen,
"0 s");
17 if (val.inSeconds() < 0) {
23 num = val.inSeconds();
26 num = val.inMilliseconds();
29 num = val.inMicroseconds();
32 num = val.inNanoseconds();
34 snprintf(out, maxlen, format, sign, num);
40#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
42std::string Time::asString()
const {
44 TimeToString(*
this, out, 16);
52String Time::asArduinoString()
const {
54 TimeToString(*
this, out, 16);
62 TimeToString(val, out, 16);
Representation of elapsed, internally stored as floating-point seconds.
For convenience conversion from roo_time::Duration.
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.
Time TimeInSeconds(float time)
Returns a time object equivalent to the specified time expressed in seconds.