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 14, 2023
2 parents 9a49f01 + a44a77c commit f9d27d9
Show file tree
Hide file tree
Showing 12 changed files with 1,440 additions and 5 deletions.
2 changes: 2 additions & 0 deletions include/etl/chrono.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,7 @@ SOFTWARE.

#include "private/chrono/duration.h"
#include "private/chrono/day.h"
#include "private/chrono/month.h"
#include "private/chrono/year.h"

#endif
9 changes: 9 additions & 0 deletions include/etl/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,14 @@ SOFTWARE.
#define ETL_HAS_VIRTUAL_MESSAGES 1
#endif

//*************************************
// Indicate if etl::literals::chrono_literals has month (_m)
#if defined(ETL_ENABLE_CHRONO_LITERALS_MONTH)
#define ETL_HAS_CHRONO_LITERALS_MONTH 1
#else
#define ETL_HAS_CHRONO_LITERALS_MONTH 0
#endif

//*************************************
// The macros below are dependent on the profile.
// C++11
Expand Down Expand Up @@ -476,6 +484,7 @@ namespace etl
static ETL_CONSTANT bool has_mutable_array_view = (ETL_HAS_MUTABLE_ARRAY_VIEW == 1);
static ETL_CONSTANT bool has_ideque_repair = (ETL_HAS_IDEQUE_REPAIR == 1);
static ETL_CONSTANT bool has_virtual_messages = (ETL_HAS_VIRTUAL_MESSAGES == 1);
static ETL_CONSTANT bool has_chrono_literals_month = (ETL_HAS_CHRONO_LITERALS_MONTH == 1);

// Is...
static ETL_CONSTANT bool is_debug_build = (ETL_IS_DEBUG_BUILD == 1);
Expand Down
20 changes: 18 additions & 2 deletions include/etl/private/chrono/day.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace etl
//***********************************************************************
/// Construct from unsigned
//***********************************************************************
ETL_CONSTEXPR day(unsigned value_)
ETL_CONSTEXPR explicit day(unsigned value_)
: value(value_)
{
}
Expand Down Expand Up @@ -161,6 +161,22 @@ namespace etl
return static_cast<unsigned>(value);
}

//***********************************************************************
/// The minimum day value for which ok() will return <b>true</b>
//***********************************************************************
static ETL_NODISCARD ETL_CONSTEXPR etl::chrono::day min() ETL_NOEXCEPT
{
return etl::chrono::day(1);
}

//***********************************************************************
/// The maximum day value for which ok() will return <b>true</b>
//***********************************************************************
static ETL_NODISCARD ETL_CONSTEXPR etl::chrono::day max() ETL_NOEXCEPT
{
return etl::chrono::day(31);
}

private:

unsigned char value;
Expand Down Expand Up @@ -267,7 +283,7 @@ namespace etl
/// Spaceship operator
//***********************************************************************
#if ETL_USING_CPP20
ETL_CONSTEXPR auto operator <=>(const etl::chrono::day& d1, const etl::chrono::day& d2)
constexpr auto operator <=>(const etl::chrono::day& d1, const etl::chrono::day& d2) noexcept
{
return (static_cast<unsigned>(d1) <=> static_cast<unsigned>(d2));
}
Expand Down
1 change: 0 additions & 1 deletion include/etl/private/chrono/duration.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ namespace etl
private:

TValue value;
//TPeriod period;
};

//***********************************************************************
Expand Down
Loading

0 comments on commit f9d27d9

Please sign in to comment.