Skip to content

Commit

Permalink
Merge branch 'feature/#757-Add-time-date-classes' of https://github.c…
Browse files Browse the repository at this point in the history
…om/ETLCPP/etl into feature/#757-Add-time-date-classes
  • Loading branch information
John Wellbelove committed Sep 17, 2023
2 parents c509333 + 20abdad commit 501a73a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/etl/private/chrono/month.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
16 changes: 16 additions & 0 deletions include/etl/private/chrono/weekday.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,24 @@ namespace etl
// std::chrono::weekday_last();
//}

//***********************************************************************
/// Returns <b>true</b> 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;
};

Expand Down

0 comments on commit 501a73a

Please sign in to comment.