AWS IoT Device SDK C++ v2  1.34.0
AWS IoT Device SDK C++ v2
Public Member Functions | Static Public Member Functions | List of all members
Aws::Crt::DateTime Class Referencefinal

#include <DateTime.h>

Public Member Functions

 DateTime () noexcept
 
 DateTime (const std::chrono::system_clock::time_point &timepointToAssign) noexcept
 
 DateTime (uint64_t millisSinceEpoch) noexcept
 
 DateTime (double epoch_millis) noexcept
 
 DateTime (const char *timestamp, DateFormat format) noexcept
 
bool operator== (const DateTime &other) const noexcept
 
bool operator< (const DateTime &other) const noexcept
 
bool operator> (const DateTime &other) const noexcept
 
bool operator!= (const DateTime &other) const noexcept
 
bool operator<= (const DateTime &other) const noexcept
 
bool operator>= (const DateTime &other) const noexcept
 
DateTime operator+ (const std::chrono::milliseconds &a) const noexcept
 
DateTime operator- (const std::chrono::milliseconds &a) const noexcept
 
DateTimeoperator= (double secondsSinceEpoch) noexcept
 
DateTimeoperator= (uint64_t millisSinceEpoch) noexcept
 
DateTimeoperator= (const std::chrono::system_clock::time_point &timepointToAssign) noexcept
 
DateTimeoperator= (const char *timestamp) noexcept
 
 operator bool () const noexcept
 
int GetLastError () const noexcept
 
bool ToLocalTimeString (DateFormat format, ByteBuf &outputBuf) const noexcept
 
bool ToGmtString (DateFormat format, ByteBuf &outputBuf) const noexcept
 
double SecondsWithMSPrecision () const noexcept
 
uint64_t Millis () const noexcept
 
std::chrono::system_clock::time_point UnderlyingTimestamp () const noexcept
 
uint16_t GetYear (bool localTime=false) const noexcept
 
Month GetMonth (bool localTime=false) const noexcept
 
uint8_t GetDay (bool localTime=false) const noexcept
 
DayOfWeek GetDayOfWeek (bool localTime=false) const noexcept
 
uint8_t GetHour (bool localTime=false) const noexcept
 
uint8_t GetMinute (bool localTime=false) const noexcept
 
uint8_t GetSecond (bool localTime=false) const noexcept
 
bool IsDST (bool localTime=false) const noexcept
 
std::chrono::milliseconds operator- (const DateTime &other) const noexcept
 

Static Public Member Functions

static DateTime Now () noexcept
 

Constructor & Destructor Documentation

◆ DateTime() [1/5]

Aws::Crt::DateTime::DateTime ( )
noexcept

Initializes time point to epoch

◆ DateTime() [2/5]

Aws::Crt::DateTime::DateTime ( const std::chrono::system_clock::time_point &  timepointToAssign)
noexcept

Initializes time point to any other arbitrary timepoint

◆ DateTime() [3/5]

Aws::Crt::DateTime::DateTime ( uint64_t  millisSinceEpoch)
noexcept

Initializes time point to millis Since epoch

◆ DateTime() [4/5]

Aws::Crt::DateTime::DateTime ( double  epoch_millis)
noexcept

Initializes time point to epoch time in seconds.millis

◆ DateTime() [5/5]

Aws::Crt::DateTime::DateTime ( const char *  timestamp,
DateFormat  format 
)
noexcept

Initializes time point to value represented by timestamp and format.

Member Function Documentation

◆ GetDay()

uint8_t Aws::Crt::DateTime::GetDay ( bool  localTime = false) const
noexcept

Get the Day of the Month portion of this dateTime. localTime if true, return local time, otherwise return UTC

◆ GetDayOfWeek()

DayOfWeek Aws::Crt::DateTime::GetDayOfWeek ( bool  localTime = false) const
noexcept

Get the Day of the Week portion of this dateTime. localTime if true, return local time, otherwise return UTC

◆ GetHour()

uint8_t Aws::Crt::DateTime::GetHour ( bool  localTime = false) const
noexcept

Get the Hour portion of this dateTime. localTime if true, return local time, otherwise return UTC

◆ GetLastError()

int Aws::Crt::DateTime::GetLastError ( ) const
noexcept

◆ GetMinute()

uint8_t Aws::Crt::DateTime::GetMinute ( bool  localTime = false) const
noexcept

Get the Minute portion of this dateTime. localTime if true, return local time, otherwise return UTC

◆ GetMonth()

Month Aws::Crt::DateTime::GetMonth ( bool  localTime = false) const
noexcept

Get the Month portion of this dateTime. localTime if true, return local time, otherwise return UTC

◆ GetSecond()

uint8_t Aws::Crt::DateTime::GetSecond ( bool  localTime = false) const
noexcept

Get the Second portion of this dateTime. localTime if true, return local time, otherwise return UTC

◆ GetYear()

uint16_t Aws::Crt::DateTime::GetYear ( bool  localTime = false) const
noexcept

Get the Year portion of this dateTime. localTime if true, return local time, otherwise return UTC

◆ IsDST()

bool Aws::Crt::DateTime::IsDST ( bool  localTime = false) const
noexcept

Get whether or not this dateTime is in Daylight savings time. localTime if true, return local time, otherwise return UTC

◆ Millis()

uint64_t Aws::Crt::DateTime::Millis ( ) const
noexcept

Milliseconds since epoch of this datetime.

◆ Now()

DateTime Aws::Crt::DateTime::Now ( )
staticnoexcept

Get an instance of DateTime representing this very instant.

◆ operator bool()

Aws::Crt::DateTime::operator bool ( ) const
explicitnoexcept

◆ operator!=()

bool Aws::Crt::DateTime::operator!= ( const DateTime other) const
noexcept

◆ operator+()

DateTime Aws::Crt::DateTime::operator+ ( const std::chrono::milliseconds &  a) const
noexcept

◆ operator-() [1/2]

std::chrono::milliseconds Aws::Crt::DateTime::operator- ( const DateTime other) const
noexcept

Computes the difference between two DateTime instances and returns the difference in milliseconds.

◆ operator-() [2/2]

DateTime Aws::Crt::DateTime::operator- ( const std::chrono::milliseconds &  a) const
noexcept

◆ operator<()

bool Aws::Crt::DateTime::operator< ( const DateTime other) const
noexcept

◆ operator<=()

bool Aws::Crt::DateTime::operator<= ( const DateTime other) const
noexcept

◆ operator=() [1/4]

DateTime & Aws::Crt::DateTime::operator= ( const char *  timestamp)
noexcept

Assign from an ISO8601 or RFC822 formatted string

◆ operator=() [2/4]

DateTime & Aws::Crt::DateTime::operator= ( const std::chrono::system_clock::time_point &  timepointToAssign)
noexcept

Assign from another time_point

◆ operator=() [3/4]

DateTime & Aws::Crt::DateTime::operator= ( double  secondsSinceEpoch)
noexcept

Assign from seconds.millis since epoch.

◆ operator=() [4/4]

DateTime & Aws::Crt::DateTime::operator= ( uint64_t  millisSinceEpoch)
noexcept

Assign from millis since epoch.

◆ operator==()

bool Aws::Crt::DateTime::operator== ( const DateTime other) const
noexcept

◆ operator>()

bool Aws::Crt::DateTime::operator> ( const DateTime other) const
noexcept

◆ operator>=()

bool Aws::Crt::DateTime::operator>= ( const DateTime other) const
noexcept

◆ SecondsWithMSPrecision()

double Aws::Crt::DateTime::SecondsWithMSPrecision ( ) const
noexcept

Get the representation of this datetime as seconds.milliseconds since epoch

◆ ToGmtString()

bool Aws::Crt::DateTime::ToGmtString ( DateFormat  format,
ByteBuf outputBuf 
) const
noexcept

Convert dateTime to GMT time string using predefined format.

◆ ToLocalTimeString()

bool Aws::Crt::DateTime::ToLocalTimeString ( DateFormat  format,
ByteBuf outputBuf 
) const
noexcept

Convert dateTime to local time string using predefined format.

◆ UnderlyingTimestamp()

std::chrono::system_clock::time_point Aws::Crt::DateTime::UnderlyingTimestamp ( ) const
noexcept

In the likely case this class doesn't do everything you need to do, here's a copy of the time_point structure. Have fun.


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