|
roo_time
API Documentation for roo_time
|
Umbrella header for the roo_time module. More...
Namespaces | |
| namespace | timezone |
Data Structures | |
| class | DateTime |
| Represents wall time decomposed into date/time in a specific time zone. More... | |
| class | Duration |
| Represents an amount of time (e.g. 5s, 10min). More... | |
| class | TimeZone |
| class | Uptime |
| Represents an instant relative to process/boot start time. More... | |
| class | WallTime |
| Represents absolute wall time since Unix epoch. More... | |
| class | WallTimeClock |
| Abstract interface for obtaining current wall time. More... | |
Typedefs | |
| using | Interval = Duration |
Backwards compatibility alias. Prefer Duration in new code. | |
Enumerations | |
| enum | DayOfWeek { kSunday = 0 , kMonday = 1 , kTuesday = 2 , kWednesday = 3 , kThursday = 4 , kFriday = 5 , kSaturday = 6 } |
| enum | Month { kJanuary = 1 , kFebruary = 2 , kMarch = 3 , kApril = 4 , kMay = 5 , kJune = 6 , kJuly = 7 , kAugust = 8 , kSeptember = 9 , kOctober = 10 , kNovember = 11 , kDecember = 12 } |
Functions | |
| constexpr Duration | Micros (long long micros) |
| Constructs a duration from microseconds. | |
| constexpr Duration | Millis (long long millis) |
| Constructs a duration from milliseconds. | |
| constexpr Duration | Millis (unsigned long long millis) |
| constexpr Duration | Millis (long millis) |
| constexpr Duration | Millis (unsigned long millis) |
| constexpr Duration | Millis (int millis) |
| constexpr Duration | Millis (unsigned int millis) |
| constexpr Duration | Millis (short millis) |
| constexpr Duration | Millis (unsigned short millis) |
| constexpr Duration | Millis (float millis) |
| constexpr Duration | Millis (double millis) |
| constexpr Duration | Seconds (long long seconds) |
| Constructs a duration from seconds. | |
| constexpr Duration | Seconds (unsigned long long seconds) |
| constexpr Duration | Seconds (long seconds) |
| constexpr Duration | Seconds (unsigned long seconds) |
| constexpr Duration | Seconds (int seconds) |
| constexpr Duration | Seconds (unsigned int seconds) |
| constexpr Duration | Seconds (short seconds) |
| constexpr Duration | Seconds (unsigned short seconds) |
| constexpr Duration | Seconds (float seconds) |
| constexpr Duration | Seconds (double seconds) |
| constexpr Duration | Minutes (long long minutes) |
| Constructs a duration from minutes. | |
| constexpr Duration | Minutes (unsigned long long minutes) |
| constexpr Duration | Minutes (long minutes) |
| constexpr Duration | Minutes (unsigned long minutes) |
| constexpr Duration | Minutes (int minutes) |
| constexpr Duration | Minutes (unsigned int minutes) |
| constexpr Duration | Minutes (short minutes) |
| constexpr Duration | Minutes (unsigned short minutes) |
| constexpr Duration | Minutes (float minutes) |
| constexpr Duration | Minutes (double minutes) |
| constexpr Duration | Hours (long long hours) |
| Constructs a duration from hours. | |
| constexpr Duration | Hours (unsigned long long minutes) |
| constexpr Duration | Hours (long minutes) |
| constexpr Duration | Hours (unsigned long minutes) |
| constexpr Duration | Hours (int minutes) |
| constexpr Duration | Hours (unsigned int minutes) |
| constexpr Duration | Hours (short minutes) |
| constexpr Duration | Hours (unsigned short minutes) |
| constexpr Duration | Hours (float hours) |
| constexpr Duration | Hours (double hours) |
| bool | operator== (const Duration &a, const Duration &b) |
| Returns true if both durations are equal. | |
| bool | operator!= (const Duration &a, const Duration &b) |
| Returns true if durations differ. | |
| bool | operator< (const Duration &a, const Duration &b) |
Returns true if a is shorter than b. | |
| bool | operator> (const Duration &a, const Duration &b) |
Returns true if a is longer than b. | |
| bool | operator<= (const Duration &a, const Duration &b) |
Returns true if a is not longer than b. | |
| bool | operator>= (const Duration &a, const Duration &b) |
Returns true if a is not shorter than b. | |
| Duration | operator+ (const Duration &a, const Duration &b) |
| Returns the sum of two durations. | |
| Duration | operator- (const Duration &a, const Duration &b) |
| Returns the difference between two durations. | |
| Duration | operator* (const Duration &a, int b) |
| Multiplies duration by an integer factor. | |
| Duration | operator* (int a, const Duration &b) |
| Multiplies duration by an integer factor. | |
| bool | operator== (const Uptime &a, const Uptime &b) |
| Returns true if uptimes are equal. | |
| bool | operator!= (const Uptime &a, const Uptime &b) |
| Returns true if uptimes differ. | |
| bool | operator< (const Uptime &a, const Uptime &b) |
Returns true if a is earlier than b. | |
| bool | operator> (const Uptime &a, const Uptime &b) |
Returns true if a is later than b. | |
| bool | operator<= (const Uptime &a, const Uptime &b) |
Returns true if a is not later than b. | |
| bool | operator>= (const Uptime &a, const Uptime &b) |
Returns true if a is not earlier than b. | |
| Duration | operator- (const Uptime &a, const Uptime &b) |
| Returns elapsed duration between two uptime instants. | |
| Uptime | operator+ (const Uptime &u, const Duration &i) |
| Returns uptime shifted by duration. | |
| Uptime | operator- (const Uptime &u, const Duration &i) |
| Returns uptime shifted backwards by duration. | |
| Uptime | operator+ (const Duration &i, const Uptime &u) |
| Returns uptime shifted by duration. | |
| void | Delay (Duration duration) |
Delays execution for duration. | |
| void | DelayUntil (Uptime deadline) |
Delays execution until deadline. | |
| bool | operator== (const WallTime &a, const WallTime &b) |
| Returns true if both wall times are equal. | |
| bool | operator!= (const WallTime &a, const WallTime &b) |
| Returns true if wall times differ. | |
| bool | operator< (const WallTime &a, const WallTime &b) |
Returns true if a is earlier than b. | |
| bool | operator> (const WallTime &a, const WallTime &b) |
Returns true if a is later than b. | |
| bool | operator<= (const WallTime &a, const WallTime &b) |
Returns true if a is not later than b. | |
| bool | operator>= (const WallTime &a, const WallTime &b) |
Returns true if a is not earlier than b. | |
| Duration | operator- (const WallTime &a, const WallTime &b) |
| Returns elapsed duration between two wall times. | |
| WallTime | operator+ (const WallTime &t, const Duration &i) |
| Returns wall time shifted by duration. | |
| WallTime | operator- (const WallTime &t, const Duration &i) |
| Returns wall time shifted backwards by duration. | |
| WallTime | operator+ (const Duration &i, const WallTime &t) |
| Returns wall time shifted by duration. | |
| bool | operator== (const DateTime &a, const DateTime &b) |
| Returns true if both date-times represent the same instant and offset. | |
| bool | operator!= (const DateTime &a, const DateTime &b) |
| Returns true if date-times differ in instant or time-zone offset. | |
Variables | |
| static int64_t | last_reading = 0 |
| static int64_t | offset = 0 |
Umbrella header for the roo_time module.
Provides duration, uptime, and wall-time abstractions. Convenience classes for handling delays and elapsed time measurement.
Helps avoid common mistakes such as mixing time units or confusing timestamps with durations.
| using roo_time::Interval = typedef Duration |
Backwards compatibility alias. Prefer Duration in new code.
Definition at line 213 of file roo_time.h.
| enum roo_time::DayOfWeek |
| Enumerator | |
|---|---|
| kSunday | |
| kMonday | |
| kTuesday | |
| kWednesday | |
| kThursday | |
| kFriday | |
| kSaturday | |
Definition at line 707 of file roo_time.h.
| enum roo_time::Month |
| Enumerator | |
|---|---|
| kJanuary | |
| kFebruary | |
| kMarch | |
| kApril | |
| kMay | |
| kJune | |
| kJuly | |
| kAugust | |
| kSeptember | |
| kOctober | |
| kNovember | |
| kDecember | |
Definition at line 717 of file roo_time.h.
Delays execution for duration.
Negative durations are treated as no-op.
Definition at line 133 of file uptime_now.cpp.
References roo_time::Duration::inMicros().
Referenced by DelayUntil().
Delays execution until deadline.
If deadline is in the past, returns immediately.
Definition at line 134 of file uptime_now.cpp.
References Delay(), and roo_time::Uptime::Now().
|
inlineconstexpr |
Definition at line 386 of file roo_time.h.
|
inlineconstexpr |
Definition at line 382 of file roo_time.h.
|
inlineconstexpr |
Definition at line 366 of file roo_time.h.
References Hours().
|
inlineconstexpr |
|
inlineconstexpr |
Definition at line 358 of file roo_time.h.
References Hours().
|
inlineconstexpr |
Definition at line 374 of file roo_time.h.
References Hours().
|
inlineconstexpr |
Definition at line 370 of file roo_time.h.
References Hours().
|
inlineconstexpr |
Definition at line 354 of file roo_time.h.
References Hours().
|
inlineconstexpr |
Definition at line 362 of file roo_time.h.
References Hours().
|
inlineconstexpr |
Definition at line 378 of file roo_time.h.
References Hours().
|
inlineconstexpr |
Constructs a duration from microseconds.
Definition at line 216 of file roo_time.h.
Referenced by roo_time::DateTime::DateTime(), operator*(), operator*(), operator+(), operator-(), and operator-().
|
inlineconstexpr |
Definition at line 257 of file roo_time.h.
|
inlineconstexpr |
Definition at line 253 of file roo_time.h.
|
inlineconstexpr |
Definition at line 237 of file roo_time.h.
References Millis().
|
inlineconstexpr |
|
inlineconstexpr |
Definition at line 229 of file roo_time.h.
References Millis().
|
inlineconstexpr |
Definition at line 245 of file roo_time.h.
References Millis().
|
inlineconstexpr |
Definition at line 241 of file roo_time.h.
References Millis().
|
inlineconstexpr |
Definition at line 225 of file roo_time.h.
References Millis().
|
inlineconstexpr |
Definition at line 233 of file roo_time.h.
References Millis().
|
inlineconstexpr |
Definition at line 249 of file roo_time.h.
References Millis().
|
inlineconstexpr |
Definition at line 343 of file roo_time.h.
|
inlineconstexpr |
Definition at line 339 of file roo_time.h.
|
inlineconstexpr |
Definition at line 323 of file roo_time.h.
References Minutes().
|
inlineconstexpr |
Constructs a duration from minutes.
Overloads accept integer and floating-point input types.
Definition at line 307 of file roo_time.h.
Referenced by Minutes(), Minutes(), Minutes(), Minutes(), Minutes(), Minutes(), Minutes(), and roo_time::TimeZone::offset().
|
inlineconstexpr |
Definition at line 315 of file roo_time.h.
References Minutes().
|
inlineconstexpr |
Definition at line 331 of file roo_time.h.
References Minutes().
|
inlineconstexpr |
Definition at line 327 of file roo_time.h.
References Minutes().
|
inlineconstexpr |
Definition at line 311 of file roo_time.h.
References Minutes().
|
inlineconstexpr |
Definition at line 319 of file roo_time.h.
References Minutes().
|
inlineconstexpr |
Definition at line 335 of file roo_time.h.
References Minutes().
Returns true if date-times differ in instant or time-zone offset.
Definition at line 837 of file roo_time.h.
References roo_time::TimeZone::offset(), roo_time::DateTime::timeZone(), and roo_time::DateTime::wallTime().
Returns true if durations differ.
Definition at line 396 of file roo_time.h.
References roo_time::Duration::inMicros().
Returns true if uptimes differ.
Definition at line 523 of file roo_time.h.
References roo_time::Uptime::inMicros().
Returns true if wall times differ.
Definition at line 618 of file roo_time.h.
References roo_time::WallTime::sinceEpoch().
Multiplies duration by an integer factor.
Definition at line 431 of file roo_time.h.
References roo_time::Duration::inMicros(), and Micros().
Multiplies duration by an integer factor.
Definition at line 436 of file roo_time.h.
References roo_time::Duration::inMicros(), and Micros().
Returns the sum of two durations.
Definition at line 421 of file roo_time.h.
References roo_time::Duration::inMicros(), and Micros().
Returns uptime shifted by duration.
Definition at line 563 of file roo_time.h.
Returns wall time shifted by duration.
Definition at line 658 of file roo_time.h.
Returns uptime shifted by duration.
Definition at line 553 of file roo_time.h.
Returns wall time shifted by duration.
Definition at line 648 of file roo_time.h.
Returns the difference between two durations.
Definition at line 426 of file roo_time.h.
References roo_time::Duration::inMicros(), and Micros().
Returns elapsed duration between two uptime instants.
Definition at line 548 of file roo_time.h.
References roo_time::Uptime::inMicros(), and Micros().
Returns uptime shifted backwards by duration.
Definition at line 558 of file roo_time.h.
Returns elapsed duration between two wall times.
Definition at line 643 of file roo_time.h.
References roo_time::WallTime::sinceEpoch().
Returns wall time shifted backwards by duration.
Definition at line 653 of file roo_time.h.
Returns true if a is shorter than b.
Definition at line 401 of file roo_time.h.
References roo_time::Duration::inMicros().
Returns true if a is earlier than b.
Definition at line 528 of file roo_time.h.
References roo_time::Uptime::inMicros().
Returns true if a is earlier than b.
Definition at line 623 of file roo_time.h.
References roo_time::WallTime::sinceEpoch().
Returns true if a is not longer than b.
Definition at line 411 of file roo_time.h.
References roo_time::Duration::inMicros().
Returns true if a is not later than b.
Definition at line 538 of file roo_time.h.
References roo_time::Uptime::inMicros().
Returns true if a is not later than b.
Definition at line 633 of file roo_time.h.
References roo_time::WallTime::sinceEpoch().
Returns true if both date-times represent the same instant and offset.
Definition at line 831 of file roo_time.h.
References roo_time::TimeZone::offset(), roo_time::DateTime::timeZone(), and roo_time::DateTime::wallTime().
Returns true if both durations are equal.
Definition at line 391 of file roo_time.h.
References roo_time::Duration::inMicros().
Returns true if uptimes are equal.
Definition at line 518 of file roo_time.h.
References roo_time::Uptime::inMicros().
Returns true if both wall times are equal.
Definition at line 613 of file roo_time.h.
References roo_time::WallTime::sinceEpoch().
Returns true if a is longer than b.
Definition at line 406 of file roo_time.h.
References roo_time::Duration::inMicros().
Returns true if a is later than b.
Definition at line 533 of file roo_time.h.
References roo_time::Uptime::inMicros().
Returns true if a is later than b.
Definition at line 628 of file roo_time.h.
References roo_time::WallTime::sinceEpoch().
Returns true if a is not shorter than b.
Definition at line 416 of file roo_time.h.
References roo_time::Duration::inMicros().
Returns true if a is not earlier than b.
Definition at line 543 of file roo_time.h.
References roo_time::Uptime::inMicros().
Returns true if a is not earlier than b.
Definition at line 638 of file roo_time.h.
References roo_time::WallTime::sinceEpoch().
|
inlineconstexpr |
Definition at line 300 of file roo_time.h.
|
inlineconstexpr |
Definition at line 296 of file roo_time.h.
|
inlineconstexpr |
Definition at line 280 of file roo_time.h.
References Seconds().
|
inlineconstexpr |
|
inlineconstexpr |
Definition at line 272 of file roo_time.h.
References Seconds().
|
inlineconstexpr |
Definition at line 288 of file roo_time.h.
References Seconds().
|
inlineconstexpr |
Definition at line 284 of file roo_time.h.
References Seconds().
|
inlineconstexpr |
Definition at line 268 of file roo_time.h.
References Seconds().
|
inlineconstexpr |
Definition at line 276 of file roo_time.h.
References Seconds().
|
inlineconstexpr |
Definition at line 292 of file roo_time.h.
References Seconds().
|
static |
Definition at line 115 of file uptime_now.cpp.
Referenced by roo_time::Uptime::Now().
|
static |
Definition at line 118 of file uptime_now.cpp.
Referenced by roo_time::Uptime::Now().