diff --git a/include/etl/private/chrono/month.h b/include/etl/private/chrono/month.h index 10316f837..fdf4153f3 100644 --- a/include/etl/private/chrono/month.h +++ b/include/etl/private/chrono/month.h @@ -187,6 +187,14 @@ namespace etl private: + //*********************************************************************** + /// Normalise to a in-range month + //*********************************************************************** + ETL_NODISCARD ETL_CONSTEXPR void normalise() + { + value = ((value % 12U) == 0U) ? 12U : value; + } + unsigned char value; }; diff --git a/include/etl/private/chrono/weekday.h b/include/etl/private/chrono/weekday.h index fa520737e..03c973377 100644 --- a/include/etl/private/chrono/weekday.h +++ b/include/etl/private/chrono/weekday.h @@ -209,8 +209,24 @@ namespace etl // std::chrono::weekday_last(); //} + //*********************************************************************** + /// Returns true if the day is a weekend. + //*********************************************************************** + ETL_NODISCARD ETL_CONSTEXPR14 bool is_weekend() + { + return (c_encoding() == 0U) || (c_encoding() == 6U); + } + private: + //*********************************************************************** + /// Normalise to a in-range weekday + //*********************************************************************** + ETL_NODISCARD ETL_CONSTEXPR void normalise() + { + value %= 7U; + } + unsigned char value; };