31#ifndef ETL_IN_CHRONO_H
32 #error DO NOT DIRECTLY INCLUDE THIS FILE. USE CHRONO.H
39 class year_month_day_last;
104 unsigned char days_in_month = etl::chrono::private_chrono::days_in_month[
current_month];
174 d <= max_day_for_month();
230 if (y <
other.y)
return -1;
231 if (y >
other.y)
return 1;
232 if (m <
other.m)
return -1;
233 if (m >
other.m)
return 1;
234 if (d <
other.d)
return -1;
235 if (d >
other.d)
return 1;
251 day_count +=
yr.is_leap() ? 366 : 365;
257 day_count += private_chrono::days_in_month[
mth];
266 day_count +=
static_cast<unsigned>(this->
day()) - 1;
288 unsigned char count = 0;
290 if (y.
ok() && m.
ok())
292 count = private_chrono::days_in_month[m];
294 if (y.
is_leap() && (m == February))
368 return (
lhs.year() ==
rhs.year()) &&
369 (
lhs.month() ==
rhs.month()) &&
385 ETL_NODISCARD ETL_CONSTEXPR14
389 if (
lhs.year() <
rhs.year())
393 else if (
lhs.year() ==
rhs.year())
395 if (
lhs.month() <
rhs.month())
399 else if (
lhs.month() ==
rhs.month())
401 return (
lhs.day() <
rhs.day());
417 ETL_NODISCARD ETL_CONSTEXPR14
427 ETL_NODISCARD ETL_CONSTEXPR14
437 ETL_NODISCARD ETL_CONSTEXPR14
451 auto cmp =
lhs.year() <=>
rhs.year();
458 cmp =
lhs.month() <=>
rhs.month();
465 return lhs.day() <=>
rhs.day();
528 ETL_CONSTEXPR14
bool ok()
const ETL_NOEXCEPT
530 return y.
ok() && m.
ok();
584 if (y <
other.y)
return -1;
585 if (y >
other.y)
return 1;
586 if (m <
other.m)
return -1;
587 if (m >
other.m)
return 1;
688 return (
lhs.year() ==
rhs.year()) &&
689 (
lhs.month() ==
rhs.month());
704 ETL_NODISCARD ETL_CONSTEXPR14
708 if (
lhs.year() <
rhs.year())
712 else if (
lhs.year() ==
rhs.year())
714 return (
lhs.month() <
rhs.month());
725 ETL_NODISCARD ETL_CONSTEXPR14
735 ETL_NODISCARD ETL_CONSTEXPR14
745 ETL_NODISCARD ETL_CONSTEXPR14
775 return lhs.month() <=>
rhs.month();
785#if ETL_USING_8BIT_TYPES
787 struct hash<
etl::chrono::year_month_day>
791 etl::chrono::year::rep y =
static_cast<etl::chrono::year::rep
>(
static_cast<unsigned>(ymd.
year()));
792 etl::chrono::month::rep m =
static_cast<etl::chrono::month::rep
>(
static_cast<unsigned>(ymd.
month()));
793 etl::chrono::day::rep d =
static_cast<etl::chrono::day::rep
>(
static_cast<unsigned>(ymd.
day()));
795 uint8_t buffer[
sizeof(y) +
sizeof(m) +
sizeof(d)];
797 memcpy(buffer, &y,
sizeof(y));
798 memcpy(buffer +
sizeof(y), &m,
sizeof(m));
799 memcpy(buffer +
sizeof(y) +
sizeof(m), &d,
sizeof(d));
801 return etl::private_hash::generic_hash<size_t>(buffer, buffer +
sizeof(y) +
sizeof(m) +
sizeof(d));
809#if ETL_USING_8BIT_TYPES
811 struct hash<
etl::chrono::year_month_day_last>
815 etl::chrono::year::rep y =
static_cast<etl::chrono::year::rep
>(
static_cast<unsigned>(ymdl.year()));
816 etl::chrono::month::rep m =
static_cast<etl::chrono::month::rep
>(
static_cast<unsigned>(ymdl.month()));
817 etl::chrono::day::rep d =
static_cast<etl::chrono::day::rep
>(
static_cast<unsigned>(ymdl.day()));
819 uint8_t buffer[
sizeof(y) +
sizeof(m) +
sizeof(d)];
821 memcpy(buffer, &y,
sizeof(y));
822 memcpy(buffer +
sizeof(y), &m,
sizeof(m));
823 memcpy(buffer +
sizeof(y) +
sizeof(m), &d,
sizeof(d));
825 return etl::private_hash::generic_hash<size_t>(buffer, buffer +
sizeof(y) +
sizeof(m) +
sizeof(d));
ETL_CONSTEXPR day() ETL_NOEXCEPT
Default constructor.
Definition day.h:51
ETL_NODISCARD ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT
Returns true if the day is within the valid 1 to 31 range.
Definition day.h:159
duration
Definition duration.h:108
Spaceship operator.
Definition month_day.h:215
month
Definition month.h:54
ETL_CONSTEXPR month() ETL_NOEXCEPT
Default constructor.
Definition month.h:62
ETL_NODISCARD ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT
Returns true if the month is within the valid 1 to 31 range.
Definition month.h:161
Definition time_point.h:45
Spaceship operator.
Definition year_month_day.h:473
ETL_NODISCARD ETL_CONSTEXPR14 operator etl::chrono::local_days() const ETL_NOEXCEPT
Converts to etl::chrono::local_days.
Definition year_month_day.h:607
ETL_NODISCARD ETL_CONSTEXPR14 int compare(const year_month_day_last &other) const ETL_NOEXCEPT
Definition year_month_day.h:582
ETL_NODISCARD ETL_CONSTEXPR14 operator etl::chrono::sys_days() const ETL_NOEXCEPT
Converts to etl::chrono::sys_days.
Definition year_month_day.h:596
year_month_day
Definition year_month_day.h:45
ETL_NODISCARD ETL_CONSTEXPR14 operator etl::chrono::local_days() const ETL_NOEXCEPT
Converts to etl::chrono::local_days.
Definition year_month_day.h:275
ETL_NODISCARD ETL_CONSTEXPR14 int compare(const year_month_day &other) const ETL_NOEXCEPT
Definition year_month_day.h:228
ETL_NODISCARD ETL_CONSTEXPR14 operator etl::chrono::sys_days() const ETL_NOEXCEPT
Converts to etl::chrono::sys_days.
Definition year_month_day.h:244
ETL_NODISCARD ETL_CONSTEXPR14 etl::chrono::month month() const ETL_NOEXCEPT
Returns the month.
Definition year_month_day.h:150
ETL_CONSTEXPR year_month_day()
Default constructor.
Definition year_month_day.h:51
ETL_NODISCARD ETL_CONSTEXPR14 etl::chrono::day day() const ETL_NOEXCEPT
Returns the day.
Definition year_month_day.h:159
ETL_CONSTEXPR14 year_month_day(const etl::chrono::year &y_, const etl::chrono::month &m_, const etl::chrono::day &d_) ETL_NOEXCEPT
Construct from month and day.
Definition year_month_day.h:61
ETL_CONSTEXPR14 year_month_day(const etl::chrono::sys_days &sd) ETL_NOEXCEPT
Construct from sys_days.
Definition year_month_day.h:78
ETL_NODISCARD ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT
Returns true if the year/month/day is valid.
Definition year_month_day.h:168
ETL_NODISCARD ETL_CONSTEXPR14 etl::chrono::year year() const ETL_NOEXCEPT
Returns the year.
Definition year_month_day.h:141
ETL_CONSTEXPR14 year_month_day(const etl::chrono::local_days &ld) ETL_NOEXCEPT
Construct from local_days.
Definition year_month_day.h:128
ETL_NODISCARD ETL_CONSTEXPR14 bool is_leap() const ETL_NOEXCEPT
Returns true if the year is a leap year.
Definition year.h:175
ETL_CONSTEXPR year() ETL_NOEXCEPT
Default constructor.
Definition year.h:51
ETL_NODISCARD ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT
Returns true if the year is within the valid -32767 to 32767 range.
Definition year.h:148
bitset_ext
Definition absolute.h:38
ETL_NODISCARD ETL_CONSTEXPR14 T round_half_even_unscaled(T value) ETL_NOEXCEPT
Definition scaled_rounding.h:314