#include <date.hpp>
Public Member Functions | |
Date (bool init=true) | |
Date (const std::time_t &time) | |
Date (const std::tm *const time) | |
Date (const std::timespec &time) | |
virtual | ~Date () |
bool | after (const Date &date) const noexcept |
bool | before (const Date &date) const noexcept |
bool | equals (const Date &date) const noexcept |
bool | operator> (const Date &date) const noexcept |
bool | operator>= (const Date &date) const noexcept |
bool | operator< (const Date &date) const noexcept |
bool | operator<= (const Date &date) const noexcept |
bool | operator== (const Date &date) const noexcept |
bool | operator!= (const Date &date) const noexcept |
operator std::time_t () const noexcept | |
operator std::tm () const noexcept | |
operator std::timespec () const noexcept | |
Protected Attributes | |
std::int64_t | _timestamp |
int32_t | _years = 0 |
uint16_t | _months = 0 |
uint16_t | _ydays = 0 |
uint16_t | _mdays = 0 |
uint16_t | _wdays = 0 |
uint16_t | _hours = 0 |
uint16_t | _minutes = 0 |
uint16_t | _seconds = 0 |
uint16_t | _milliseconds = 0 |
uint16_t | _microseconds = 0 |
uint16_t | _nanoseconds = 0 |
Static Protected Attributes | |
static std::mutex | _mutex |
Friends | |
class | formatter::IDatePartFormatter |
class | DateFormatter |
Date and time utility class.
The class implementation is thread safe (when using this class).
POSIX time management is not thread safe. This class uses POSIX implementation.
Be aware that if you use the POSIX API, you will loose the thread safe support provided in this implementation.
anch::date::Date::Date | ( | bool | init = true | ) |
anch::date::Date::Date | ( | const std::time_t & | time | ) |
Date constructor.
time | The time to set |
anch::date::Date::Date | ( | const std::tm *const | time | ) |
Date constructor.
time | The time to set |
anch::date::Date::Date | ( | const std::timespec & | time | ) |
Date constructor.
time | The time to set |
|
virtual |
Date destructor
Reimplemented in anch::sql::Date.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Cast operator to std::time_t definition.
|
inlinenoexcept |
Cast operator to std::timespec definition.
|
inlinenoexcept |
Cast operator to std::tm definition.
|
inlinenoexcept |
'!=' operator definition. Calls equals method
date | The date to compare to |
|
inlinenoexcept |
'<' operator definition. Calls before method
date | The date to compare to |
|
inlinenoexcept |
'<=' operator definition. Calls before and equals methods
date | The date to compare to |
|
inlinenoexcept |
'==' operator definition. Calls equals method
date | The date to compare to |
|
inlinenoexcept |
'>' operator definition. Calls after method
date | The date to compare to |
|
inlinenoexcept |
'>=' operator definition. Calls after and equals methods
date | The date to compare to |
|
protected |
The minutes (0-23 => 5 bits)
|
protected |
The days of the year (1-31 => 5 bits)
|
protected |
The microseconds (0-999 => 10 bits)
|
protected |
The milliseconds (0-999 => 10 bits)
|
protected |
The minutes (0-59 => 6 bits)
|
protected |
The months (0-11 => 4 bits)
|
staticprotected |
Mutex for thread-safe implementation
|
protected |
The nanoseconds (0-999 => 10 bits)
|
protected |
The seconds (0-60 => 6 bits)
|
protected |
The timestamp
|
protected |
The days of the week (0-6 => 3 bits)
|
protected |
The days of the year (0-365 => 9 bits)
|
protected |
The years