roo_time
API Documentation for roo_time
Loading...
Searching...
No Matches
roo_time::Uptime Class Reference

Represents an instant relative to process/boot start time. More...

#include <roo_time.h>

Public Member Functions

 Uptime ()
 Constructs zero uptime value.
 
 Uptime (const Uptime &other)
 Copy constructor.
 
 Uptime (const volatile Uptime &other)
 Copy constructor for volatile sources.
 
Uptimeoperator= (const Uptime &other)
 Assignment operator.
 
Uptimeoperator= (const volatile Uptime &other)
 Assignment operator for volatile sources.
 
int64_t inMicros () const
 Returns uptime in microseconds.
 
int64_t inMillis () const
 Returns uptime in milliseconds.
 
int64_t inSeconds () const
 Returns uptime in seconds.
 
int64_t inMinutes () const
 Returns uptime in minutes.
 
int64_t inHours () const
 Returns uptime in hours.
 
Uptimeoperator+= (const Duration &i)
 Adds duration to this uptime.
 
Uptimeoperator-= (const Duration &i)
 Subtracts duration from this uptime.
 

Static Public Member Functions

static const Uptime Now ()
 Returns current monotonic process uptime.
 
static const Uptime Start ()
 Returns uptime value at process start.
 
static const Uptime Max ()
 Returns the maximum representable uptime value.
 

Friends

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.
 

Detailed Description

Represents an instant relative to process/boot start time.

Stored with microsecond precision and 64-bit range. May not include sleep time on some platforms.

Definition at line 444 of file roo_time.h.

Constructor & Destructor Documentation

◆ Uptime() [1/3]

roo_time::Uptime::Uptime ( )
inline

Constructs zero uptime value.

Definition at line 456 of file roo_time.h.

Referenced by Max(), Now(), and Start().

◆ Uptime() [2/3]

roo_time::Uptime::Uptime ( const Uptime other)
inline

Copy constructor.

Definition at line 459 of file roo_time.h.

◆ Uptime() [3/3]

roo_time::Uptime::Uptime ( const volatile Uptime other)
inline

Copy constructor for volatile sources.

Definition at line 462 of file roo_time.h.

Member Function Documentation

◆ inHours()

int64_t roo_time::Uptime::inHours ( ) const
inline

Returns uptime in hours.

Definition at line 489 of file roo_time.h.

◆ inMicros()

int64_t roo_time::Uptime::inMicros ( ) const
inline

◆ inMillis()

int64_t roo_time::Uptime::inMillis ( ) const
inline

Returns uptime in milliseconds.

Definition at line 480 of file roo_time.h.

◆ inMinutes()

int64_t roo_time::Uptime::inMinutes ( ) const
inline

Returns uptime in minutes.

Definition at line 486 of file roo_time.h.

◆ inSeconds()

int64_t roo_time::Uptime::inSeconds ( ) const
inline

Returns uptime in seconds.

Definition at line 483 of file roo_time.h.

◆ Max()

static const Uptime roo_time::Uptime::Max ( )
inlinestatic

Returns the maximum representable uptime value.

Definition at line 453 of file roo_time.h.

References Uptime().

◆ Now()

const Uptime IRAM_ATTR roo_time::Uptime::Now ( )
static

Returns current monotonic process uptime.

Definition at line 120 of file uptime_now.cpp.

References roo_time::last_reading, roo_time::offset, and Uptime().

Referenced by roo_time::DelayUntil().

◆ operator+=()

Uptime & roo_time::Uptime::operator+= ( const Duration i)
inline

Adds duration to this uptime.

Definition at line 496 of file roo_time.h.

References roo_time::Duration::inMicros().

◆ operator-=()

Uptime & roo_time::Uptime::operator-= ( const Duration i)
inline

Subtracts duration from this uptime.

Definition at line 502 of file roo_time.h.

References roo_time::Duration::inMicros().

◆ operator=() [1/2]

Uptime & roo_time::Uptime::operator= ( const Uptime other)
inline

Assignment operator.

Definition at line 465 of file roo_time.h.

◆ operator=() [2/2]

Uptime & roo_time::Uptime::operator= ( const volatile Uptime other)
inline

Assignment operator for volatile sources.

Definition at line 471 of file roo_time.h.

◆ Start()

static const Uptime roo_time::Uptime::Start ( )
inlinestatic

Returns uptime value at process start.

Definition at line 450 of file roo_time.h.

References Uptime().

Friends And Related Symbol Documentation

◆ operator+ [1/2]

Uptime operator+ ( const Duration i,
const Uptime u 
)
friend

Returns uptime shifted by duration.

Definition at line 563 of file roo_time.h.

◆ operator+ [2/2]

Uptime operator+ ( const Uptime u,
const Duration i 
)
friend

Returns uptime shifted by duration.

Definition at line 553 of file roo_time.h.

◆ operator-

Uptime operator- ( const Uptime u,
const Duration i 
)
friend

Returns uptime shifted backwards by duration.

Definition at line 558 of file roo_time.h.


The documentation for this class was generated from the following files: