#include <modm/math/calendar/date_time.hpp>
|
using | duration = std::chrono::milliseconds |
|
using | precision = typename duration::period |
|
|
constexpr | DateTime (uint16_t year, uint8_t month, uint8_t day, uint8_t hour=0, uint8_t minute=0, uint8_t second=0, uint16_t millisecond=0, uint8_t weekday=0) |
| This is an efficient conversion.
|
|
constexpr | DateTime (const std::chrono::year_month_day &ymd, const std::chrono::hours &hours=std::chrono::hours::zero (), const std::chrono::minutes &minutes=std::chrono::minutes::zero (), const std::chrono::seconds &seconds=std::chrono::seconds::zero (), const std::chrono::milliseconds &subseconds=std::chrono::milliseconds::zero ()) |
| This computes the weekday from the date, which is somewhat expensive.
|
|
constexpr std::chrono::year | year () const |
|
constexpr std::chrono::month | month () const |
|
constexpr std::chrono::day | day () const |
|
constexpr std::chrono::year_month_day | year_month_day () const |
| This is an efficient conversion.
|
|
constexpr std::chrono::weekday | weekday () const |
|
constexpr std::chrono::days | day_of_year () const |
|
constexpr std::chrono::hours | hours () const |
|
constexpr std::chrono::minutes | minutes () const |
|
constexpr std::chrono::seconds | seconds () const |
|
constexpr std::chrono::milliseconds | subseconds () const |
|
constexpr std::chrono::hh_mm_ss< duration > | hh_mm_ss () const |
|
constexpr std::tm | tm () const |
| This is an efficient conversion.
|
|
constexpr std::time_t | time_t () const |
|
constexpr struct timeval | timeval () const |
|
constexpr duration | time_since_epoch () const |
|
constexpr auto | operator<=> (const DateTime &other) const |
|
constexpr auto | operator== (const DateTime &other) const |
|
|
static constexpr DateTime | from_tm (const std::tm &tm) |
| Efficient conversion.
|
|
static constexpr DateTime | from_time_t (std::time_t tt, const std::chrono::milliseconds &subseconds=std::chrono::milliseconds::zero ()) |
| Really expensive conversion!
|
|
static constexpr DateTime | from_timeval (const struct timeval &tv) |
| Really expensive conversion!
|
|
static consteval DateTime | fromBuildTime () |
|
Efficient representation of a date and time
constexpr std::chrono::hh_mm_ss<duration> modm::DateTime::hh_mm_ss |
( |
| ) |
const |
|
inlineconstexpr |
- Warning
- This function is very inefficient due to an unnecessary conversion from hh:mm:ss.ms to ms then back to hh:mm:ss.ms in the constructor. This is a limitation of the stdc++ constructor.
constexpr duration modm::DateTime::time_since_epoch |
( |
| ) |
const |
|
inlineconstexpr |
- Warning
- This function is inefficient since it always converts the datetime to milliseconds.
constexpr std::time_t modm::DateTime::time_t |
( |
| ) |
const |
|
inlineconstexpr |
- Warning
- This function is inefficient since it always converts the datetime to seconds.
constexpr struct timeval modm::DateTime::timeval |
( |
| ) |
const |
|
inline |
- Warning
- This function is inefficient since it always converts the datetime to microseconds.
The documentation for this class was generated from the following file: