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

Represents wall time decomposed into date/time in a specific time zone. More...

#include <roo_time.h>

Public Member Functions

 DateTime ()
 Constructs DateTime representing current time in UTC.
 
 DateTime (uint16_t year, uint8_t month, uint8_t day, TimeZone tz)
 Constructs DateTime at midnight of a date in the specified time zone.
 
 DateTime (uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint32_t micros, TimeZone tz)
 Constructs date/time in the specified time zone.
 
 DateTime (WallTime wallTime, TimeZone tz)
 Constructs DateTime for wallTime in time zone tz.
 
WallTime wallTime () const
 Returns WallTime corresponding to this DateTime.
 
TimeZone timeZone () const
 Returns time zone of this DateTime.
 
int16_t year () const
 Returns four-digit year.
 
Month month () const
 Returns month in [1, 12].
 
uint8_t day () const
 Returns day of month in valid range.
 
uint8_t hour () const
 Returns hour in [0, 23].
 
uint8_t minute () const
 Returns minute in [0, 59].
 
uint8_t second () const
 Returns second in [0, 59].
 
uint32_t micros () const
 Returns microsecond fraction in [0, 999999].
 
DayOfWeek dayOfWeek () const
 Returns day of week in this time zone.
 
uint16_t dayOfYear () const
 Returns day of year in [1, 366].
 

Detailed Description

Represents wall time decomposed into date/time in a specific time zone.

Does not account for leap seconds.

Definition at line 735 of file roo_time.h.

Constructor & Destructor Documentation

◆ DateTime() [1/4]

roo_time::DateTime::DateTime ( )
inline

Constructs DateTime representing current time in UTC.

Definition at line 738 of file roo_time.h.

◆ DateTime() [2/4]

roo_time::DateTime::DateTime ( uint16_t  year,
uint8_t  month,
uint8_t  day,
TimeZone  tz 
)

Constructs DateTime at midnight of a date in the specified time zone.

Parameters
yearFour-digit year.
monthMonth in [1, 12].
dayDay in [1, max_day_of_month].

Definition at line 120 of file roo_time.cpp.

◆ DateTime() [3/4]

roo_time::DateTime::DateTime ( uint16_t  year,
uint8_t  month,
uint8_t  day,
uint8_t  hour,
uint8_t  minute,
uint8_t  second,
uint32_t  micros,
TimeZone  tz 
)

Constructs date/time in the specified time zone.

Parameters
yearFour-digit year.
monthMonth in [1, 12].
dayDay in [1, max_day_of_month].
hourHour in [0, 23].
minuteMinute in [0, 59].
secondSecond in [0, 59].
microsMicrosecond fraction in [0, 999999].
tzTime zone to interpret the components in.

Definition at line 123 of file roo_time.cpp.

References day(), hour(), micros(), roo_time::Micros(), minute(), month(), roo_time::TimeZone::offset(), second(), and year().

◆ DateTime() [4/4]

roo_time::DateTime::DateTime ( WallTime  wallTime,
TimeZone  tz 
)

Constructs DateTime for wallTime in time zone tz.

Definition at line 140 of file roo_time.cpp.

References roo_time::Duration::inHours(), roo_time::Duration::inMicros(), roo_time::TimeZone::offset(), and roo_time::WallTime::sinceEpoch().

Member Function Documentation

◆ day()

uint8_t roo_time::DateTime::day ( ) const
inline

Returns day of month in valid range.

Definition at line 776 of file roo_time.h.

Referenced by DateTime().

◆ dayOfWeek()

DayOfWeek roo_time::DateTime::dayOfWeek ( ) const
inline

Returns day of week in this time zone.

Definition at line 791 of file roo_time.h.

◆ dayOfYear()

uint16_t roo_time::DateTime::dayOfYear ( ) const
inline

Returns day of year in [1, 366].

Definition at line 794 of file roo_time.h.

◆ hour()

uint8_t roo_time::DateTime::hour ( ) const
inline

Returns hour in [0, 23].

Definition at line 779 of file roo_time.h.

Referenced by DateTime().

◆ micros()

uint32_t roo_time::DateTime::micros ( ) const
inline

Returns microsecond fraction in [0, 999999].

Definition at line 788 of file roo_time.h.

Referenced by DateTime().

◆ minute()

uint8_t roo_time::DateTime::minute ( ) const
inline

Returns minute in [0, 59].

Definition at line 782 of file roo_time.h.

Referenced by DateTime().

◆ month()

Month roo_time::DateTime::month ( ) const
inline

Returns month in [1, 12].

Definition at line 773 of file roo_time.h.

Referenced by DateTime().

◆ second()

uint8_t roo_time::DateTime::second ( ) const
inline

Returns second in [0, 59].

Definition at line 785 of file roo_time.h.

Referenced by DateTime().

◆ timeZone()

TimeZone roo_time::DateTime::timeZone ( ) const
inline

Returns time zone of this DateTime.

Definition at line 767 of file roo_time.h.

Referenced by roo_time::operator!=(), and roo_time::operator==().

◆ wallTime()

WallTime roo_time::DateTime::wallTime ( ) const
inline

Returns WallTime corresponding to this DateTime.

Definition at line 764 of file roo_time.h.

Referenced by roo_time::operator!=(), and roo_time::operator==().

◆ year()

int16_t roo_time::DateTime::year ( ) const
inline

Returns four-digit year.

Definition at line 770 of file roo_time.h.

Referenced by DateTime().


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