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
80 *
this += etl::chrono::months(1);
102 *
this -= etl::chrono::months(1);
142 ETL_NODISCARD ETL_CONSTEXPR14
bool ok() const ETL_NOEXCEPT
144 return (value >= 1U) && (value <= 12U);
153 ETL_NODISCARD ETL_CONSTEXPR14
int compare(
const month& other)
const ETL_NOEXCEPT
155 if (value < other.value)
157 if (value > other.value)
166 ETL_CONSTEXPR14
operator unsigned() const ETL_NOEXCEPT
181 return (
static_cast<unsigned>(d1) ==
static_cast<unsigned>(d2));
197 return (
static_cast<unsigned>(d1) <
static_cast<unsigned>(d2));
205 return (
static_cast<unsigned>(d1) <=
static_cast<unsigned>(d2));
213 return (
static_cast<unsigned>(d1) >
static_cast<unsigned>(d2));
221 return (
static_cast<unsigned>(d1) >=
static_cast<unsigned>(d2));
231 return (
static_cast<unsigned>(d1) <=>
static_cast<unsigned>(d2));
241 unsigned int value =
static_cast<unsigned int>(m);
250 int delta = ms.count() % 12;
254 value +=
static_cast<unsigned int>(delta);
276 return m + etl::chrono::months(-ms.count());
285 if (m1.ok() && m2.ok())
288 int difference =
static_cast<int>(
static_cast<unsigned>(m1)) -
static_cast<int>(
static_cast<unsigned>(m2));
296 etl::chrono::months ms(difference);
299 assert(m1 == (m2 + ms));
303 return etl::chrono::months();
309 inline constexpr etl::chrono::month March{3};
310 inline constexpr etl::chrono::month April{4};
311 inline constexpr etl::chrono::month May{5};
312 inline constexpr etl::chrono::month June{6};
313 inline constexpr etl::chrono::month July{7};
314 inline constexpr etl::chrono::month August{8};
315 inline constexpr etl::chrono::month September{9};
316 inline constexpr etl::chrono::month October{10};
317 inline constexpr etl::chrono::month November{11};
318 inline constexpr etl::chrono::month December{12};
320 static ETL_CONSTANT etl::chrono::month January{1};
321 static ETL_CONSTANT etl::chrono::month February{2};
322 static ETL_CONSTANT etl::chrono::month March{3};
323 static ETL_CONSTANT etl::chrono::month April{4};
324 static ETL_CONSTANT etl::chrono::month May{5};
325 static ETL_CONSTANT etl::chrono::month June{6};
326 static ETL_CONSTANT etl::chrono::month July{7};
327 static ETL_CONSTANT etl::chrono::month August{8};
328 static ETL_CONSTANT etl::chrono::month September{9};
329 static ETL_CONSTANT etl::chrono::month October{10};
330 static ETL_CONSTANT etl::chrono::month November{11};
331 static ETL_CONSTANT etl::chrono::month December{12};
338#if ETL_USING_8BIT_TYPES
342 size_t operator()(
const etl::chrono::month& m)
const
344 etl::chrono::month::rep value =
static_cast<etl::chrono::month::rep
>(
static_cast<unsigned>(m));
345 const uint8_t* p =
reinterpret_cast<const uint8_t*
>(&value);
347 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:100
ETL_CONSTEXPR14 etl::chrono::month & operator++() ETL_NOEXCEPT
Pre-increment operator.
Definition month.h:78
ETL_CONSTEXPR14 etl::chrono::month & operator+=(const etl::chrono::months &ms) ETL_NOEXCEPT
Plus-equals operator adding etl::chrono::months.
Definition month.h:122
ETL_CONSTEXPR14 etl::chrono::month operator++(int) ETL_NOEXCEPT
Post-increment operator.
Definition month.h:88
ETL_CONSTEXPR14 etl::chrono::month operator--(int) ETL_NOEXCEPT
Post-decrement operator.
Definition month.h:110
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:132
ETL_NODISCARD ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT
Returns true if the month is within the valid 1 to 12 range.
Definition month.h:142
ETL_NODISCARD ETL_CONSTEXPR14 int compare(const month &other) const ETL_NOEXCEPT
Definition month.h:153
ETL_CONSTEXPR14 etl::chrono::day operator+(const etl::chrono::day &d, const etl::chrono::days &ds) ETL_NOEXCEPT
Spaceship operator.
Definition day.h:226
ETL_CONSTEXPR14 etl::chrono::day operator-(const etl::chrono::day &d, const etl::chrono::days &ds) ETL_NOEXCEPT
Definition day.h:252
ETL_CONSTEXPR14 bool operator<(const etl::chrono::day &d1, const etl::chrono::day &d2) ETL_NOEXCEPT
Less-than operator.
Definition day.h:182
ETL_CONSTEXPR14 bool operator>=(const etl::chrono::day &d1, const etl::chrono::day &d2) ETL_NOEXCEPT
Greater-than-or-equal operator.
Definition day.h:206
ETL_CONSTEXPR14 bool operator==(const etl::chrono::day &d1, const etl::chrono::day &d2) ETL_NOEXCEPT
Equality operator.
Definition day.h:166
ETL_CONSTEXPR14 bool operator<=(const etl::chrono::day &d1, const etl::chrono::day &d2) ETL_NOEXCEPT
Less-than-or-equal operator.
Definition day.h:190
ETL_CONSTEXPR14 bool operator!=(const etl::chrono::day &d1, const etl::chrono::day &d2) ETL_NOEXCEPT
Inequality operator.
Definition day.h:174
ETL_CONSTEXPR14 bool operator>(const etl::chrono::day &d1, const etl::chrono::day &d2) ETL_NOEXCEPT
Greater-than operator.
Definition day.h:198
bitset_ext
Definition absolute.h:40