31#ifndef ETL_IN_CHRONO_H
32 #error DO NOT DIRECTLY INCLUDE THIS FILE. USE CHRONO.H
41 ETL_CONSTEXPR14 etl::chrono::month operator +(
const etl::chrono::month& m,
const etl::chrono::months& ms) ETL_NOEXCEPT;
42 ETL_CONSTEXPR14 etl::chrono::month operator +(
const etl::chrono::months& ms,
const etl::chrono::month& m) ETL_NOEXCEPT;
43 ETL_CONSTEXPR14 etl::chrono::month operator -(
const etl::chrono::month& m,
const etl::chrono::months& ms) ETL_NOEXCEPT;
45 namespace private_chrono
47 static ETL_CONSTANT
unsigned char days_in_month[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
57 using rep = uint_least8_t;
62 ETL_CONSTEXPR
month() ETL_NOEXCEPT
70 ETL_CONSTEXPR
explicit month(
unsigned value_) ETL_NOEXCEPT
98 *
this += etl::chrono::months(1);
110 *
this += etl::chrono::months(1);
120 *
this -= etl::chrono::months(1);
132 *
this -= etl::chrono::months(1);
161 ETL_CONSTEXPR14
bool ok() const ETL_NOEXCEPT
163 return (value >= 1U) && (value <= 12U);
175 if (value < other.value)
return -1;
176 if (value > other.value)
return 1;
202 ETL_CONSTEXPR14
operator unsigned() const ETL_NOEXCEPT
204 return static_cast<unsigned>(value);
217 return (
static_cast<unsigned>(d1) ==
static_cast<unsigned>(d2));
233 return (
static_cast<unsigned>(d1) <
static_cast<unsigned>(d2));
241 return (
static_cast<unsigned>(d1) <=
static_cast<unsigned>(d2));
249 return (
static_cast<unsigned>(d1) >
static_cast<unsigned>(d2));
257 return (
static_cast<unsigned>(d1) >=
static_cast<unsigned>(d2));
266 return (
static_cast<unsigned>(d1) <=>
static_cast<unsigned>(d2));
276 unsigned int value =
static_cast<unsigned int>(m);
285 int delta = ms.count() % 12;
311 return m + etl::chrono::months(-ms.count());
320 if (m1.ok() && m2.ok())
323 int difference =
static_cast<int>(
static_cast<unsigned>(m1)) -
static_cast<int>(
static_cast<unsigned>(m2));
331 etl::chrono::months ms(difference);
340 return etl::chrono::months();
346 inline constexpr etl::chrono::month March{ 3 };
347 inline constexpr etl::chrono::month April{ 4 };
348 inline constexpr etl::chrono::month May{ 5 };
349 inline constexpr etl::chrono::month June{ 6 };
350 inline constexpr etl::chrono::month July{ 7 };
351 inline constexpr etl::chrono::month August{ 8 };
352 inline constexpr etl::chrono::month September{ 9 };
353 inline constexpr etl::chrono::month October{ 10 };
354 inline constexpr etl::chrono::month November{ 11 };
355 inline constexpr etl::chrono::month December{ 12 };
357 static ETL_CONSTANT etl::chrono::month January{ 1 };
358 static ETL_CONSTANT etl::chrono::month February{ 2 };
359 static ETL_CONSTANT etl::chrono::month March{ 3 };
360 static ETL_CONSTANT etl::chrono::month April{ 4 };
361 static ETL_CONSTANT etl::chrono::month May{ 5 };
362 static ETL_CONSTANT etl::chrono::month June{ 6 };
363 static ETL_CONSTANT etl::chrono::month July{ 7 };
364 static ETL_CONSTANT etl::chrono::month August{ 8 };
365 static ETL_CONSTANT etl::chrono::month September{ 9 };
366 static ETL_CONSTANT etl::chrono::month October{ 10 };
367 static ETL_CONSTANT etl::chrono::month November{ 11 };
368 static ETL_CONSTANT etl::chrono::month December{ 12 };
375#if ETL_USING_8BIT_TYPES
379 size_t operator()(
const etl::chrono::month& m)
const
381 etl::chrono::month::rep value =
static_cast<etl::chrono::month::rep
>(
static_cast<unsigned>(m));
382 const uint8_t* p =
reinterpret_cast<const uint8_t*
>(&value);
384 return etl::private_hash::generic_hash<size_t>(p, p +
sizeof(value));
month
Definition month.h:54
ETL_CONSTEXPR month() ETL_NOEXCEPT
Default constructor.
Definition month.h:62
ETL_CONSTEXPR14 etl::chrono::month & operator--() ETL_NOEXCEPT
Pre-decrement operator.
Definition month.h:118
static ETL_NODISCARD ETL_CONSTEXPR14 etl::chrono::month max() ETL_NOEXCEPT
The maximum month value for which ok() will return true.
Definition month.h:194
ETL_CONSTEXPR14 etl::chrono::month & operator++() ETL_NOEXCEPT
Pre-increment operator.
Definition month.h:96
ETL_CONSTEXPR14 etl::chrono::month & operator=(const etl::chrono::month &rhs) ETL_NOEXCEPT
Assignment operator.
Definition month.h:86
ETL_CONSTEXPR14 etl::chrono::month & operator+=(const etl::chrono::months &ms) ETL_NOEXCEPT
Plus-equals operator adding etl::chrono::months.
Definition month.h:140
static ETL_NODISCARD ETL_CONSTEXPR14 etl::chrono::month min() ETL_NOEXCEPT
The minimum month value for which ok() will return true.
Definition month.h:185
ETL_CONSTEXPR14 month(const etl::chrono::month &other) ETL_NOEXCEPT
Copy constructor.
Definition month.h:78
ETL_CONSTEXPR month(unsigned value_) ETL_NOEXCEPT
Construct from unsigned.
Definition month.h:70
ETL_CONSTEXPR14 etl::chrono::month & operator-=(const etl::chrono::months &ms) ETL_NOEXCEPT
Minus-equals operator subtracting etl::chrono::months.
Definition month.h:150
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
ETL_NODISCARD ETL_CONSTEXPR14 int compare(const month &other) const ETL_NOEXCEPT
Definition month.h:173
bitset_ext
Definition absolute.h:39