mirror of
https://github.com/ETLCPP/etl.git
synced 2026-10-28 18:07:10 +08:00
Fixed constexpr labels + other small changes to fix syntax check errors.
This commit is contained in:
parent
c25df24b03
commit
3f138f68b9
@ -64,7 +64,7 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Copy constructor
|
||||
//***********************************************************************
|
||||
ETL_CONSTEXPR day(const etl::chrono::day& other) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 day(const etl::chrono::day& other) ETL_NOEXCEPT
|
||||
: value(other.value)
|
||||
{
|
||||
}
|
||||
@ -152,6 +152,7 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Returns <b>true</b> if the day is within the valid 1 to 31 range
|
||||
//***********************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT
|
||||
{
|
||||
return (value >= 1U) && (value <= 31U);
|
||||
@ -171,6 +172,7 @@ namespace etl
|
||||
/// else if day > other, returns 1;
|
||||
/// else returns 0;
|
||||
//***********************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 int compare(const day& other) const ETL_NOEXCEPT
|
||||
{
|
||||
if (value < other.value) return -1;
|
||||
@ -182,7 +184,8 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// The minimum day value for which ok() will return <b>true</b>
|
||||
//***********************************************************************
|
||||
static ETL_CONSTEXPR etl::chrono::day min() ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
static ETL_CONSTEXPR14 etl::chrono::day min() ETL_NOEXCEPT
|
||||
{
|
||||
return etl::chrono::day(1);
|
||||
}
|
||||
@ -190,7 +193,8 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// The maximum day value for which ok() will return <b>true</b>
|
||||
//***********************************************************************
|
||||
static ETL_CONSTEXPR etl::chrono::day max() ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
static ETL_CONSTEXPR14 etl::chrono::day max() ETL_NOEXCEPT
|
||||
{
|
||||
return etl::chrono::day(31);
|
||||
}
|
||||
|
||||
@ -71,19 +71,22 @@ namespace etl
|
||||
struct duration_values
|
||||
{
|
||||
//***********************************************************************
|
||||
ETL_NODISCARD
|
||||
static ETL_CONSTEXPR TRep zero() ETL_NOEXCEPT
|
||||
{
|
||||
return TRep(0);
|
||||
}
|
||||
|
||||
//***********************************************************************
|
||||
static ETL_CONSTEXPR TRep min() ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
static ETL_CONSTEXPR14 TRep min() ETL_NOEXCEPT
|
||||
{
|
||||
return etl::numeric_limits<TRep>::min();
|
||||
}
|
||||
|
||||
//***********************************************************************
|
||||
static ETL_CONSTEXPR TRep max() ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
static ETL_CONSTEXPR14 TRep max() ETL_NOEXCEPT
|
||||
{
|
||||
return etl::numeric_limits<TRep>::max();
|
||||
}
|
||||
@ -113,14 +116,14 @@ namespace etl
|
||||
}
|
||||
|
||||
//***********************************************************************
|
||||
ETL_CONSTEXPR duration(const etl::chrono::duration<TRep, TPeriod>& other) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 duration(const etl::chrono::duration<TRep, TPeriod>& other) ETL_NOEXCEPT
|
||||
: value(other.value)
|
||||
{
|
||||
}
|
||||
|
||||
//***********************************************************************
|
||||
template <typename TRep2>
|
||||
ETL_CONSTEXPR explicit duration(const TRep2& value_) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 explicit duration(const TRep2& value_) ETL_NOEXCEPT
|
||||
: value(static_cast<TRep>(value_))
|
||||
{
|
||||
}
|
||||
@ -171,24 +174,28 @@ namespace etl
|
||||
}
|
||||
|
||||
//***********************************************************************
|
||||
ETL_NODISCARD
|
||||
static ETL_CONSTEXPR14 etl::chrono::duration<TRep, TPeriod> zero() ETL_NOEXCEPT
|
||||
{
|
||||
return etl::chrono::duration<TRep, TPeriod>(etl::chrono::duration_values<TRep>::zero());
|
||||
}
|
||||
|
||||
//***********************************************************************
|
||||
ETL_NODISCARD
|
||||
static ETL_CONSTEXPR14 etl::chrono::duration<TRep, TPeriod> min() ETL_NOEXCEPT
|
||||
{
|
||||
return etl::chrono::duration<TRep, TPeriod>(etl::chrono::duration_values<TRep>::min());
|
||||
}
|
||||
|
||||
//***********************************************************************
|
||||
ETL_NODISCARD
|
||||
static ETL_CONSTEXPR14 etl::chrono::duration<TRep, TPeriod> max() ETL_NOEXCEPT
|
||||
{
|
||||
return etl::chrono::duration<TRep, TPeriod>(etl::chrono::duration_values<TRep>::max());
|
||||
}
|
||||
|
||||
//***********************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::duration<TRep, TPeriod> absolute() const ETL_NOEXCEPT
|
||||
{
|
||||
return etl::chrono::duration<TRep, TPeriod>(value < 0 ? -value : value);
|
||||
|
||||
@ -105,8 +105,7 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Default constructor.
|
||||
//***********************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14
|
||||
ETL_CONSTEXPR
|
||||
hh_mm_ss() ETL_NOEXCEPT
|
||||
: d(TDuration::zero())
|
||||
{
|
||||
@ -115,7 +114,6 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Construct from duration.
|
||||
//***********************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14
|
||||
explicit hh_mm_ss(TDuration d_) ETL_NOEXCEPT
|
||||
: d(d_)
|
||||
@ -179,6 +177,7 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Returns the duration.
|
||||
//***********************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 explicit operator precision() const ETL_NOEXCEPT
|
||||
{
|
||||
return to_duration();
|
||||
|
||||
@ -38,9 +38,9 @@ namespace etl
|
||||
{
|
||||
struct last_spec
|
||||
{
|
||||
//ETL_CONSTEXPR14 explicit last_spec()
|
||||
//{
|
||||
//}
|
||||
ETL_CONSTEXPR explicit last_spec()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#if ETL_USING_CPP17
|
||||
|
||||
@ -75,7 +75,7 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Copy constructor
|
||||
//***********************************************************************
|
||||
ETL_CONSTEXPR month(const etl::chrono::month& other) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 month(const etl::chrono::month& other) ETL_NOEXCEPT
|
||||
: value(other.value)
|
||||
{
|
||||
}
|
||||
@ -157,7 +157,8 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Returns <b>true</b> if the month is within the valid 1 to 31 range
|
||||
//***********************************************************************
|
||||
ETL_CONSTEXPR bool ok() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT
|
||||
{
|
||||
return (value >= 1U) && (value <= 12U);
|
||||
}
|
||||
@ -168,6 +169,7 @@ namespace etl
|
||||
/// else if month > other, returns 1;
|
||||
/// else returns 0;
|
||||
//***********************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 int compare(const month& other) const ETL_NOEXCEPT
|
||||
{
|
||||
if (value < other.value) return -1;
|
||||
@ -179,7 +181,8 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// The minimum month value for which ok() will return <b>true</b>
|
||||
//***********************************************************************
|
||||
static ETL_CONSTEXPR etl::chrono::month min() ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
static ETL_CONSTEXPR14 etl::chrono::month min() ETL_NOEXCEPT
|
||||
{
|
||||
return etl::chrono::month(1);
|
||||
}
|
||||
@ -187,7 +190,8 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// The maximum month value for which ok() will return <b>true</b>
|
||||
//***********************************************************************
|
||||
static ETL_CONSTEXPR etl::chrono::month max() ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
static ETL_CONSTEXPR14 etl::chrono::month max() ETL_NOEXCEPT
|
||||
{
|
||||
return etl::chrono::month(12);
|
||||
}
|
||||
@ -195,7 +199,7 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Conversion operator to unsigned int
|
||||
//***********************************************************************
|
||||
ETL_CONSTEXPR operator unsigned() const ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 operator unsigned() const ETL_NOEXCEPT
|
||||
{
|
||||
return static_cast<unsigned>(value);
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Construct from month and day.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR month_day(const etl::chrono::month& m_,
|
||||
ETL_CONSTEXPR14 month_day(const etl::chrono::month& m_,
|
||||
const etl::chrono::day& d_) ETL_NOEXCEPT
|
||||
: m(m_)
|
||||
, d(d_)
|
||||
@ -58,7 +58,8 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns the month.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR etl::chrono::month month() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::month month() const ETL_NOEXCEPT
|
||||
{
|
||||
return m;
|
||||
}
|
||||
@ -66,7 +67,8 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns the day.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR etl::chrono::day day() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::day day() const ETL_NOEXCEPT
|
||||
{
|
||||
return d;
|
||||
}
|
||||
@ -74,6 +76,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns true if the month/day is valid.
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT
|
||||
{
|
||||
if (!m.ok() || !d.ok())
|
||||
@ -188,6 +191,7 @@ namespace etl
|
||||
/// else if day > other.day, returns 1;
|
||||
/// else returns 0;
|
||||
//***********************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 int compare(const month_day& other) const ETL_NOEXCEPT
|
||||
{
|
||||
if (m < other.m) return -1;
|
||||
|
||||
@ -43,8 +43,8 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Construct from month and weekday_indexed.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR month_weekday(const etl::chrono::month& m_,
|
||||
const etl::chrono::weekday_indexed& wdi_) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 month_weekday(const etl::chrono::month& m_,
|
||||
const etl::chrono::weekday_indexed& wdi_) ETL_NOEXCEPT
|
||||
: m(m_)
|
||||
, wdi(wdi_)
|
||||
{
|
||||
@ -53,7 +53,8 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns the month.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR etl::chrono::month month() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::month month() const ETL_NOEXCEPT
|
||||
{
|
||||
return m;
|
||||
}
|
||||
@ -61,7 +62,8 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns the weekday_indexed.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR etl::chrono::weekday_indexed weekday_indexed() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::weekday_indexed weekday_indexed() const ETL_NOEXCEPT
|
||||
{
|
||||
return wdi;
|
||||
}
|
||||
@ -69,7 +71,8 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns true if the month/day is valid.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR bool ok() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT
|
||||
{
|
||||
return m.ok() && wdi.ok();
|
||||
}
|
||||
@ -108,7 +111,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Construct from month and weekday_indexed.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR month_weekday_last(const etl::chrono::month& m_,
|
||||
ETL_CONSTEXPR14 month_weekday_last(const etl::chrono::month& m_,
|
||||
const etl::chrono::weekday_last& wdl_) ETL_NOEXCEPT
|
||||
: m(m_)
|
||||
, wdl(wdl_)
|
||||
@ -118,7 +121,8 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns the month.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR etl::chrono::month month() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::month month() const ETL_NOEXCEPT
|
||||
{
|
||||
return m;
|
||||
}
|
||||
@ -126,7 +130,8 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns the weekday_indexed.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR etl::chrono::weekday_last weekday_last() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::weekday_last weekday_last() const ETL_NOEXCEPT
|
||||
{
|
||||
return wdl;
|
||||
}
|
||||
@ -134,7 +139,8 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns true if the month/day is valid.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR bool ok() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT
|
||||
{
|
||||
return m.ok() && wdl.ok();
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ namespace etl
|
||||
//***************************************************************************
|
||||
/// Construct from a duration.
|
||||
//***************************************************************************
|
||||
ETL_CONSTEXPR explicit time_point(const duration& dur_) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 explicit time_point(const duration& dur_) ETL_NOEXCEPT
|
||||
: dur(dur_)
|
||||
{
|
||||
}
|
||||
@ -69,7 +69,7 @@ namespace etl
|
||||
//***************************************************************************
|
||||
/// Copy constructor.
|
||||
//***************************************************************************
|
||||
ETL_CONSTEXPR time_point(const time_point& rhs) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 time_point(const time_point& rhs) ETL_NOEXCEPT
|
||||
: dur(rhs.dur)
|
||||
{
|
||||
}
|
||||
@ -96,6 +96,7 @@ namespace etl
|
||||
//***************************************************************************
|
||||
/// Returns a duration representing the amount of time between this and the clock's epoch.
|
||||
//***************************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 duration time_since_epoch() const ETL_NOEXCEPT
|
||||
{
|
||||
return dur;
|
||||
@ -124,7 +125,8 @@ namespace etl
|
||||
//***************************************************************************
|
||||
/// Returns a time_point with the smallest possible duration.
|
||||
//***************************************************************************
|
||||
static ETL_CONSTEXPR time_point min() ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
static ETL_CONSTEXPR14 time_point min() ETL_NOEXCEPT
|
||||
{
|
||||
return time_point(duration::min());
|
||||
}
|
||||
@ -132,7 +134,8 @@ namespace etl
|
||||
//***************************************************************************
|
||||
/// Returns a time_point with the largest possible duration.
|
||||
//***************************************************************************
|
||||
static ETL_CONSTEXPR time_point max() ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
static ETL_CONSTEXPR14 time_point max() ETL_NOEXCEPT
|
||||
{
|
||||
return time_point(duration::max());
|
||||
}
|
||||
@ -146,6 +149,7 @@ namespace etl
|
||||
/// Rounds down a duration to the nearest lower precision.
|
||||
//***********************************************************************
|
||||
template <typename TToDuration, typename TClock, typename TDuration>
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14
|
||||
etl::chrono::time_point<TClock, TToDuration>
|
||||
floor(const etl::chrono::time_point<TClock, TDuration>& tp) ETL_NOEXCEPT
|
||||
@ -157,6 +161,7 @@ namespace etl
|
||||
/// Rounds up a duration to the nearest higher precision.
|
||||
//***********************************************************************
|
||||
template <typename TToDuration, typename TClock, typename TDuration>
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14
|
||||
etl::chrono::time_point<TClock, TToDuration>
|
||||
ceil(const etl::chrono::time_point<TClock, TDuration>& tp) ETL_NOEXCEPT
|
||||
@ -169,6 +174,7 @@ namespace etl
|
||||
/// If the duration is exactly halfway, it rounds away from zero.
|
||||
//***********************************************************************
|
||||
template <typename TToDuration, typename TClock, typename TDuration>
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14
|
||||
etl::chrono::time_point<TClock, TToDuration>
|
||||
round(const etl::chrono::time_point<TClock, TDuration>& tp) ETL_NOEXCEPT
|
||||
@ -177,6 +183,7 @@ namespace etl
|
||||
}
|
||||
|
||||
template <typename TToDuration, typename TClock, typename TDuration>
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14
|
||||
etl::chrono::time_point<TClock, TToDuration>
|
||||
time_point_cast(const etl::chrono::time_point<TClock, TDuration>& tp) ETL_NOEXCEPT
|
||||
|
||||
@ -71,25 +71,21 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Construct from sys_days.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR weekday(const etl::chrono::sys_days& sd) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 weekday(const etl::chrono::sys_days& sd) ETL_NOEXCEPT
|
||||
: value(255U)
|
||||
{
|
||||
// Get number of days since epoch
|
||||
// Get number of days since epoch.
|
||||
etl::chrono::days days_since_epoch = sd.time_since_epoch();
|
||||
|
||||
// Convert to weekday manually: epoch was Thursday (4)
|
||||
// Convert to weekday. Beginning of the epoch was a Thursday (4).
|
||||
value = (days_since_epoch.count() + 4) % 7;
|
||||
|
||||
// Normalize in case of negative modulo
|
||||
if (value < 0)
|
||||
{
|
||||
value += 7;
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Construct from local_days.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR weekday(const etl::chrono::local_days& ld) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 weekday(const etl::chrono::local_days& ld) ETL_NOEXCEPT
|
||||
: value(255U)
|
||||
{
|
||||
weekday wd(sys_days(ld.time_since_epoch()));
|
||||
|
||||
@ -99,7 +95,7 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Copy constructor
|
||||
//***********************************************************************
|
||||
ETL_CONSTEXPR weekday(const etl::chrono::weekday& other) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 weekday(const etl::chrono::weekday& other) ETL_NOEXCEPT
|
||||
: value(other.value)
|
||||
{
|
||||
}
|
||||
@ -181,7 +177,8 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Returns <b>true</b> if the weekday is within the valid 1 to 31 range
|
||||
//***********************************************************************
|
||||
ETL_CONSTEXPR bool ok() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT
|
||||
{
|
||||
return (c_encoding() <= 6U);
|
||||
}
|
||||
@ -190,7 +187,8 @@ namespace etl
|
||||
/// The minimum weekday value for which ok() will return <b>true</b>
|
||||
/// C encoding.
|
||||
//***********************************************************************
|
||||
static ETL_CONSTEXPR unsigned min() ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
static ETL_CONSTEXPR14 unsigned min() ETL_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -199,7 +197,8 @@ namespace etl
|
||||
/// The maximum weekday value for which ok() will return <b>true</b>
|
||||
/// C encoding.
|
||||
//***********************************************************************
|
||||
static ETL_CONSTEXPR unsigned max() ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
static ETL_CONSTEXPR14 unsigned max() ETL_NOEXCEPT
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
@ -207,7 +206,8 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Get the C encoding of the weekday
|
||||
//***********************************************************************
|
||||
ETL_CONSTEXPR unsigned c_encoding() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 unsigned c_encoding() const ETL_NOEXCEPT
|
||||
{
|
||||
return value;
|
||||
}
|
||||
@ -215,7 +215,8 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Get the ISO encoding of the weekday
|
||||
//***********************************************************************
|
||||
ETL_CONSTEXPR unsigned iso_encoding() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 unsigned iso_encoding() const ETL_NOEXCEPT
|
||||
{
|
||||
return (value == 0U) ? 7U : value;
|
||||
}
|
||||
@ -223,17 +224,20 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Index operator from index
|
||||
//***********************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::weekday_indexed operator[](unsigned index) const ETL_NOEXCEPT;
|
||||
|
||||
//***********************************************************************
|
||||
/// Index operator from etl::chrono::last_spec
|
||||
//***********************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::weekday_last operator[](etl::chrono::last_spec last) const ETL_NOEXCEPT;
|
||||
|
||||
//***********************************************************************
|
||||
/// Returns <b>true</b> if the day is a weekend.
|
||||
//***********************************************************************
|
||||
ETL_CONSTEXPR bool is_weekend() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 bool is_weekend() const ETL_NOEXCEPT
|
||||
{
|
||||
return (c_encoding() == 0U) || (c_encoding() == 6U);
|
||||
}
|
||||
@ -321,7 +325,7 @@ namespace etl
|
||||
inline constexpr etl::chrono::weekday Thursday{ 4U };
|
||||
inline constexpr etl::chrono::weekday Friday{ 5U };
|
||||
inline constexpr etl::chrono::weekday Saturday{ 6U };
|
||||
#else
|
||||
#else
|
||||
static ETL_CONSTANT etl::chrono::weekday Sunday{ 0U };
|
||||
static ETL_CONSTANT etl::chrono::weekday Monday{ 1U };
|
||||
static ETL_CONSTANT etl::chrono::weekday Tuesday{ 2U };
|
||||
@ -350,7 +354,7 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Construct from weekday and index
|
||||
//***********************************************************************
|
||||
ETL_CONSTEXPR weekday_indexed(const etl::chrono::weekday& wd_, unsigned index_) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 weekday_indexed(const etl::chrono::weekday& wd_, unsigned index_) ETL_NOEXCEPT
|
||||
: wd(wd_)
|
||||
, i(static_cast<uint_least8_t>(index_))
|
||||
{
|
||||
@ -359,7 +363,7 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Copy constructor
|
||||
//***********************************************************************
|
||||
ETL_CONSTEXPR weekday_indexed(const etl::chrono::weekday_indexed& other) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 weekday_indexed(const etl::chrono::weekday_indexed& other) ETL_NOEXCEPT
|
||||
: wd(other.wd)
|
||||
, i(other.i)
|
||||
{
|
||||
@ -379,7 +383,8 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Get weekday
|
||||
//***********************************************************************
|
||||
ETL_NODISCARD ETL_CONSTEXPR etl::chrono::weekday weekday() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_NODISCARD ETL_CONSTEXPR14 etl::chrono::weekday weekday() const ETL_NOEXCEPT
|
||||
{
|
||||
return wd;
|
||||
}
|
||||
@ -387,7 +392,8 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Get index
|
||||
//***********************************************************************
|
||||
ETL_NODISCARD ETL_CONSTEXPR unsigned index() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_NODISCARD ETL_CONSTEXPR14 unsigned index() const ETL_NOEXCEPT
|
||||
{
|
||||
return i;
|
||||
}
|
||||
@ -395,7 +401,8 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Returns <b>true</b> if the weekday and index are valid
|
||||
//***********************************************************************
|
||||
ETL_NODISCARD ETL_CONSTEXPR bool ok() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_NODISCARD ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT
|
||||
{
|
||||
return wd.ok() && (i >= 1U) && (i <= 5U);
|
||||
}
|
||||
@ -433,7 +440,7 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Construct from unsigned
|
||||
//***********************************************************************
|
||||
ETL_CONSTEXPR explicit weekday_last(const etl::chrono::weekday& wd_) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 explicit weekday_last(const etl::chrono::weekday& wd_) ETL_NOEXCEPT
|
||||
: wd(wd_)
|
||||
{
|
||||
}
|
||||
@ -441,7 +448,7 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Copy constructor
|
||||
//***********************************************************************
|
||||
ETL_CONSTEXPR weekday_last(const etl::chrono::weekday_last& other) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 weekday_last(const etl::chrono::weekday_last& other) ETL_NOEXCEPT
|
||||
: wd(other.wd)
|
||||
{
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Copy constructor
|
||||
//***********************************************************************
|
||||
ETL_CONSTEXPR year(const etl::chrono::year& other) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 year(const etl::chrono::year& other) ETL_NOEXCEPT
|
||||
: value(other.value)
|
||||
{
|
||||
}
|
||||
@ -144,7 +144,8 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Returns <b>true</b> if the year is within the valid -32767 to 32767 range
|
||||
//***********************************************************************
|
||||
ETL_CONSTEXPR bool ok() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT
|
||||
{
|
||||
return (value != etl::integral_limits<int16_t>::min);
|
||||
}
|
||||
@ -152,7 +153,8 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// The minimum year value for which ok() will return <b>true</b>
|
||||
//***********************************************************************
|
||||
static ETL_CONSTEXPR etl::chrono::year min() ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
static ETL_CONSTEXPR14 etl::chrono::year min() ETL_NOEXCEPT
|
||||
{
|
||||
return etl::chrono::year(-32767);
|
||||
}
|
||||
@ -160,7 +162,8 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// The maximum year value for which ok() will return <b>true</b>
|
||||
//***********************************************************************
|
||||
static ETL_CONSTEXPR etl::chrono::year max() ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
static ETL_CONSTEXPR14 etl::chrono::year max() ETL_NOEXCEPT
|
||||
{
|
||||
return etl::chrono::year(32767);
|
||||
}
|
||||
@ -168,7 +171,8 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Returns <b>true</b> if the year is a leap year
|
||||
//***********************************************************************
|
||||
ETL_CONSTEXPR bool is_leap() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 bool is_leap() const ETL_NOEXCEPT
|
||||
{
|
||||
return ((value % 4) == 0) && // Divisible by 4
|
||||
(((value % 100) != 0) || // but not divisible by 100
|
||||
@ -178,7 +182,7 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Conversion operator to unsigned int
|
||||
//***********************************************************************
|
||||
ETL_CONSTEXPR operator int() const ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 operator int() const ETL_NOEXCEPT
|
||||
{
|
||||
return static_cast<int>(value);
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Default constructor.
|
||||
//*************************************************************************
|
||||
year_month()
|
||||
ETL_CONSTEXPR year_month()
|
||||
: y()
|
||||
, m()
|
||||
{
|
||||
@ -52,8 +52,8 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Construct from month and day.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR year_month(const etl::chrono::year& y_,
|
||||
const etl::chrono::month& m_) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 year_month(const etl::chrono::year& y_,
|
||||
const etl::chrono::month& m_) ETL_NOEXCEPT
|
||||
: y(y_)
|
||||
, m(m_)
|
||||
{
|
||||
@ -62,7 +62,8 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns the year.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR etl::chrono::year year() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::year year() const ETL_NOEXCEPT
|
||||
{
|
||||
return y;
|
||||
}
|
||||
@ -70,7 +71,8 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns the month.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR etl::chrono::month month() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::month month() const ETL_NOEXCEPT
|
||||
{
|
||||
return m;
|
||||
}
|
||||
@ -78,7 +80,8 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns true if the month/day is valid.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR bool ok() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT
|
||||
{
|
||||
return y.ok() && m.ok();
|
||||
}
|
||||
@ -150,7 +153,7 @@ namespace etl
|
||||
/// Equality operator.
|
||||
//*************************************************************************
|
||||
friend ETL_CONSTEXPR14 bool operator ==(const etl::chrono::year_month& lhs,
|
||||
const etl::chrono::year_month& rhs) ETL_NOEXCEPT
|
||||
const etl::chrono::year_month& rhs) ETL_NOEXCEPT
|
||||
{
|
||||
return (lhs.y == rhs.y) && (lhs.m == rhs.m);
|
||||
}
|
||||
@ -159,7 +162,7 @@ namespace etl
|
||||
/// Inequality operator.
|
||||
//*************************************************************************
|
||||
friend ETL_CONSTEXPR14 bool operator !=(const etl::chrono::year_month& lhs,
|
||||
const etl::chrono::year_month& rhs) ETL_NOEXCEPT
|
||||
const etl::chrono::year_month& rhs) ETL_NOEXCEPT
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
@ -58,9 +58,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Construct from month and day.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR year_month_day(const etl::chrono::year& y_,
|
||||
const etl::chrono::month& m_,
|
||||
const etl::chrono::day& d_) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 year_month_day(const etl::chrono::year& y_,
|
||||
const etl::chrono::month& m_,
|
||||
const etl::chrono::day& d_) ETL_NOEXCEPT
|
||||
: y(y_)
|
||||
, m(m_)
|
||||
, d(d_)
|
||||
@ -70,12 +70,12 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Construct from year_month_day_last.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR year_month_day(const etl::chrono::year_month_day_last& ymdl) ETL_NOEXCEPT;
|
||||
ETL_CONSTEXPR14 year_month_day(const etl::chrono::year_month_day_last& ymdl) ETL_NOEXCEPT;
|
||||
|
||||
//*************************************************************************
|
||||
/// Construct from sys_days.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR year_month_day(const etl::chrono::sys_days& sd) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 year_month_day(const etl::chrono::sys_days& sd) ETL_NOEXCEPT
|
||||
{
|
||||
// Days since 1970-01-01
|
||||
int days_since_epoch = static_cast<int>(sd.time_since_epoch().count());
|
||||
@ -125,7 +125,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Construct from sys_days.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR year_month_day(const etl::chrono::local_days& ld) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 year_month_day(const etl::chrono::local_days& ld) ETL_NOEXCEPT
|
||||
{
|
||||
etl::chrono::year_month_day ymd = sys_days(ld.time_since_epoch());
|
||||
|
||||
@ -137,7 +137,8 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns the year.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR etl::chrono::year year() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::year year() const ETL_NOEXCEPT
|
||||
{
|
||||
return y;
|
||||
}
|
||||
@ -145,7 +146,8 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns the month.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR etl::chrono::month month() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::month month() const ETL_NOEXCEPT
|
||||
{
|
||||
return m;
|
||||
}
|
||||
@ -153,7 +155,8 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns the day.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR etl::chrono::day day() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::day day() const ETL_NOEXCEPT
|
||||
{
|
||||
return d;
|
||||
}
|
||||
@ -161,6 +164,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns true if the year/month/day is valid.
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT
|
||||
{
|
||||
// Check if the year, month, and day are valid individually
|
||||
@ -228,7 +232,7 @@ namespace etl
|
||||
/// Equality operator.
|
||||
//*************************************************************************
|
||||
friend ETL_CONSTEXPR14 bool operator ==(const etl::chrono::year_month_day& lhs,
|
||||
const etl::chrono::year_month_day& rhs) ETL_NOEXCEPT
|
||||
const etl::chrono::year_month_day& rhs) ETL_NOEXCEPT
|
||||
{
|
||||
return (lhs.y == rhs.y) && (lhs.m == rhs.m) && (lhs.d == rhs.d);
|
||||
}
|
||||
@ -237,7 +241,7 @@ namespace etl
|
||||
/// Inequality operator.
|
||||
//*************************************************************************
|
||||
friend ETL_CONSTEXPR14 bool operator !=(const etl::chrono::year_month_day& lhs,
|
||||
const etl::chrono::year_month_day& rhs) ETL_NOEXCEPT
|
||||
const etl::chrono::year_month_day& rhs) ETL_NOEXCEPT
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
@ -277,6 +281,7 @@ namespace etl
|
||||
/// else if day > other.day, returns 1;
|
||||
/// else returns 0;
|
||||
//***********************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 int compare(const year_month_day& other) const ETL_NOEXCEPT
|
||||
{
|
||||
if (y < other.y) return -1;
|
||||
@ -292,6 +297,7 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Converts to etl::chrono::sys_days
|
||||
//***********************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 operator etl::chrono::sys_days() const ETL_NOEXCEPT
|
||||
{
|
||||
int day_count = 0;
|
||||
@ -322,6 +328,7 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Converts to etl::chrono::local_days
|
||||
//***********************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 explicit operator etl::chrono::local_days() const ETL_NOEXCEPT
|
||||
{
|
||||
return local_days(sys_days(*this).time_since_epoch());
|
||||
@ -375,6 +382,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
///
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::year year() const ETL_NOEXCEPT
|
||||
{
|
||||
return y;
|
||||
@ -383,6 +391,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
///
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::month month() const ETL_NOEXCEPT
|
||||
{
|
||||
return m;
|
||||
@ -391,6 +400,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
///
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::day day() const ETL_NOEXCEPT
|
||||
{
|
||||
etl::chrono::day d = etl::chrono::day(etl::chrono::private_chrono::days_in_month[m]);
|
||||
@ -401,6 +411,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
///
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::month_day_last month_day_last() const ETL_NOEXCEPT
|
||||
{
|
||||
return etl::chrono::month_day_last(m);
|
||||
@ -409,6 +420,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
///
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT
|
||||
{
|
||||
return y.ok() && m.ok();
|
||||
@ -512,7 +524,7 @@ namespace etl
|
||||
/// Equality operator.
|
||||
//*************************************************************************
|
||||
friend ETL_CONSTEXPR14 bool operator ==(const etl::chrono::year_month_day_last& lhs,
|
||||
const etl::chrono::year_month_day_last& rhs) ETL_NOEXCEPT
|
||||
const etl::chrono::year_month_day_last& rhs) ETL_NOEXCEPT
|
||||
{
|
||||
return (lhs.y == rhs.y) && (lhs.m == rhs.m);
|
||||
}
|
||||
@ -563,6 +575,7 @@ namespace etl
|
||||
/// else if month > other.month, returns 1;
|
||||
/// else returns 0;
|
||||
//***********************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 int compare(const year_month_day_last& other) const ETL_NOEXCEPT
|
||||
{
|
||||
if (y < other.y) return -1;
|
||||
@ -576,6 +589,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Converts to etl::chrono::sys_days
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 operator etl::chrono::sys_days() const ETL_NOEXCEPT
|
||||
{
|
||||
etl::chrono::year_month_day ymd(year(), month(), day());
|
||||
@ -586,6 +600,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Converts to etl::chrono::local_days
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 explicit operator etl::chrono::local_days() const ETL_NOEXCEPT
|
||||
{
|
||||
return local_days(sys_days(*this).time_since_epoch());
|
||||
@ -600,7 +615,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Construct from year_month_day_last.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR etl::chrono::year_month_day::year_month_day(const etl::chrono::year_month_day_last& ymdl) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 etl::chrono::year_month_day::year_month_day(const etl::chrono::year_month_day_last& ymdl) ETL_NOEXCEPT
|
||||
: y(ymdl.year())
|
||||
, m(ymdl.month())
|
||||
, d(ymdl.day())
|
||||
|
||||
@ -56,9 +56,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Construct from month, day, and weekday_indexed.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR year_month_weekday(const etl::chrono::year& y_,
|
||||
const etl::chrono::month& m_,
|
||||
const etl::chrono::weekday_indexed& wdi_) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 year_month_weekday(const etl::chrono::year& y_,
|
||||
const etl::chrono::month& m_,
|
||||
const etl::chrono::weekday_indexed& wdi_) ETL_NOEXCEPT
|
||||
: y(y_)
|
||||
, m(m_)
|
||||
, wdi(wdi_)
|
||||
@ -68,7 +68,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Construct from sys_days.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR year_month_weekday(const etl::chrono::sys_days& sd) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 year_month_weekday(const etl::chrono::sys_days& sd) ETL_NOEXCEPT
|
||||
{
|
||||
// Extract year, month, and day
|
||||
year_month_day ymd = year_month_day{sd};
|
||||
@ -97,7 +97,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Construct from local_days.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR year_month_weekday(const etl::chrono::local_days& ld) ETL_NOEXCEPT
|
||||
ETL_CONSTEXPR14 year_month_weekday(const etl::chrono::local_days& ld) ETL_NOEXCEPT
|
||||
{
|
||||
year_month_weekday ymwd(sys_days(ld.time_since_epoch()));
|
||||
|
||||
@ -109,7 +109,8 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns the year.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR etl::chrono::year year() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::year year() const ETL_NOEXCEPT
|
||||
{
|
||||
return y;
|
||||
}
|
||||
@ -117,7 +118,8 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns the month.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR etl::chrono::month month() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::month month() const ETL_NOEXCEPT
|
||||
{
|
||||
return m;
|
||||
}
|
||||
@ -125,7 +127,8 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns the weekday.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR etl::chrono::weekday weekday() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::weekday weekday() const ETL_NOEXCEPT
|
||||
{
|
||||
return wdi.weekday();
|
||||
}
|
||||
@ -133,7 +136,8 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns the weekday index.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR unsigned index() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 unsigned index() const ETL_NOEXCEPT
|
||||
{
|
||||
return wdi.index();
|
||||
}
|
||||
@ -141,7 +145,8 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns the weekday_indexed.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR etl::chrono::weekday_indexed weekday_indexed() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::weekday_indexed weekday_indexed() const ETL_NOEXCEPT
|
||||
{
|
||||
return wdi;
|
||||
}
|
||||
@ -149,7 +154,8 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns true if the year/month/day is valid.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR bool ok() const ETL_NOEXCEPT
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT
|
||||
{
|
||||
return y.ok() && m.ok() && wdi.ok();
|
||||
}
|
||||
@ -229,6 +235,7 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Converts to etl::chrono::sys_days
|
||||
//***********************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 operator etl::chrono::sys_days() const ETL_NOEXCEPT
|
||||
{
|
||||
if (ok())
|
||||
@ -260,6 +267,7 @@ namespace etl
|
||||
//***********************************************************************
|
||||
/// Converts to etl::chrono::local_days
|
||||
//***********************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 operator etl::chrono::local_days() const ETL_NOEXCEPT
|
||||
{
|
||||
return local_days(sys_days(*this).time_since_epoch());
|
||||
@ -294,6 +302,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns the year.
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::year year() const ETL_NOEXCEPT
|
||||
{
|
||||
return y;
|
||||
@ -302,6 +311,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns the month.
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::month month() const ETL_NOEXCEPT
|
||||
{
|
||||
return m;
|
||||
@ -310,6 +320,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns the weekday.
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::weekday weekday() const ETL_NOEXCEPT
|
||||
{
|
||||
return wdl.weekday();
|
||||
@ -318,6 +329,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns the weekday_last.
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 etl::chrono::weekday_last weekday_last() const ETL_NOEXCEPT
|
||||
{
|
||||
return wdl;
|
||||
@ -472,6 +484,7 @@ namespace etl
|
||||
/// else if month > other.month, returns 1;
|
||||
/// else returns 0;
|
||||
//***********************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 int compare(const etl::chrono::year_month_weekday_last& other) const ETL_NOEXCEPT
|
||||
{
|
||||
if (y < other.y) return -1;
|
||||
@ -485,6 +498,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Converts to etl::chrono::sys_days
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 operator etl::chrono::sys_days() const ETL_NOEXCEPT
|
||||
{
|
||||
// Get the last day of the month
|
||||
@ -513,6 +527,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Converts to etl::chrono::local_days
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD
|
||||
ETL_CONSTEXPR14 explicit operator etl::chrono::local_days() const ETL_NOEXCEPT
|
||||
{
|
||||
return local_days(sys_days(*this).time_since_epoch());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user