31#ifndef ETL_IN_CHRONO_H
32 #error DO NOT DIRECTLY INCLUDE THIS FILE. USE CHRONO.H
46 ETL_CONSTEXPR14 etl::chrono::weekday operator +(
const etl::chrono::weekday& m,
const etl::chrono::days& ds) ETL_NOEXCEPT;
47 ETL_CONSTEXPR14 etl::chrono::weekday operator +(
const etl::chrono::days& ds,
const etl::chrono::weekday& m) ETL_NOEXCEPT;
48 ETL_CONSTEXPR14 etl::chrono::weekday operator -(
const etl::chrono::weekday& m,
const etl::chrono::days& ds) ETL_NOEXCEPT;
68 ETL_CONSTEXPR
explicit weekday(
unsigned value_) ETL_NOEXCEPT
69 : value(value_ == 7U ? 0U :value_)
76 ETL_CONSTEXPR14
weekday(
const etl::chrono::sys_days& sd) ETL_NOEXCEPT
80 etl::chrono::days days_since_epoch = sd.time_since_epoch();
83 value = (days_since_epoch.count() + 4) % 7;
89 ETL_CONSTEXPR14
weekday(
const etl::chrono::local_days& ld) ETL_NOEXCEPT
92 weekday wd(sys_days(ld.time_since_epoch()));
120 *
this += etl::chrono::days(1);
132 *
this += etl::chrono::days(1);
142 *
this -= etl::chrono::days(1);
154 *
this -= etl::chrono::days(1);
183 ETL_CONSTEXPR14
bool ok() const ETL_NOEXCEPT
193 static ETL_CONSTEXPR14
unsigned min() ETL_NOEXCEPT
203 static ETL_CONSTEXPR14
unsigned max() ETL_NOEXCEPT
223 return (value == 0U) ? 7U : value;
258 return (wd1.c_encoding() == wd2.c_encoding());
266 return !(wd1 == wd2);
275 int delta = ds.count() % 7;
277 unsigned int value = wd.c_encoding();
303 return m + etl::chrono::days(-ds.count());
312 if (wd1.ok() && wd2.ok())
314 int diff =
static_cast<int>(wd1.c_encoding()) -
static_cast<int>(wd2.c_encoding());
316 return etl::chrono::days((diff + 7) % 7);
319 return etl::chrono::days(0);
325 inline constexpr etl::chrono::weekday Tuesday{ 2U };
326 inline constexpr etl::chrono::weekday Wednesday{ 3U };
327 inline constexpr etl::chrono::weekday Thursday{ 4U };
328 inline constexpr etl::chrono::weekday Friday{ 5U };
329 inline constexpr etl::chrono::weekday Saturday{ 6U };
331 static ETL_CONSTANT etl::chrono::weekday Sunday{ 0U };
332 static ETL_CONSTANT etl::chrono::weekday Monday{ 1U };
333 static ETL_CONSTANT etl::chrono::weekday Tuesday{ 2U };
334 static ETL_CONSTANT etl::chrono::weekday Wednesday{ 3U };
335 static ETL_CONSTANT etl::chrono::weekday Thursday{ 4U };
336 static ETL_CONSTANT etl::chrono::weekday Friday{ 5U };
337 static ETL_CONSTANT etl::chrono::weekday Saturday{ 6U };
361 , i(
static_cast<uint_least8_t
>(index_))
398 ETL_NODISCARD ETL_CONSTEXPR14
unsigned index() const ETL_NOEXCEPT
407 ETL_NODISCARD ETL_CONSTEXPR14
bool ok() const ETL_NOEXCEPT
409 return wd.ok() && (i >= 1U) && (i <= 5U);
423 return (wd1.weekday() == wd2.weekday()) &&
424 (wd1.index() == wd2.index());
432 return !(wd1 == wd2);
479 ETL_NODISCARD ETL_CONSTEXPR14
bool ok() const ETL_NOEXCEPT
494 return (wd1.weekday() == wd2.weekday());
517#if ETL_USING_8BIT_TYPES
524 const uint8_t* p =
reinterpret_cast<const uint8_t*
>(&value);
526 return etl::private_hash::generic_hash<size_t>(p, p +
sizeof(
unsigned));
534#if ETL_USING_8BIT_TYPES
538 size_t operator()(
const etl::chrono::weekday_indexed& wdi)
const
541 unsigned int b = wdi.
index();
543 uint8_t buffer[
sizeof(a) +
sizeof(b)];
545 memcpy(buffer, &a,
sizeof(a));
546 memcpy(buffer +
sizeof(a), &b,
sizeof(b));
548 return etl::private_hash::generic_hash<size_t>(buffer, buffer +
sizeof(a) +
sizeof(b));
556#if ETL_USING_8BIT_TYPES
560 size_t operator()(
const etl::chrono::weekday_last& wdl)
const
562 return etl::hash<etl::chrono::weekday>()(wdl.
weekday());
weekday_indexed
Definition weekday.h:344
ETL_NODISCARD ETL_NODISCARD ETL_CONSTEXPR14 etl::chrono::weekday weekday() const ETL_NOEXCEPT
Get weekday.
Definition weekday.h:389
ETL_CONSTEXPR14 etl::chrono::weekday_indexed & operator=(const etl::chrono::weekday_indexed &rhs) ETL_NOEXCEPT
Assignment operator.
Definition weekday.h:377
ETL_CONSTEXPR14 weekday_indexed(const etl::chrono::weekday &wd_, unsigned index_) ETL_NOEXCEPT
Construct from weekday and index.
Definition weekday.h:359
ETL_NODISCARD ETL_NODISCARD ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT
Returns true if the weekday and index are valid.
Definition weekday.h:407
ETL_NODISCARD ETL_NODISCARD ETL_CONSTEXPR14 unsigned index() const ETL_NOEXCEPT
Get index.
Definition weekday.h:398
ETL_CONSTEXPR weekday_indexed() ETL_NOEXCEPT
Default constructor.
Definition weekday.h:350
ETL_CONSTEXPR14 weekday_indexed(const etl::chrono::weekday_indexed &other) ETL_NOEXCEPT
Copy constructor.
Definition weekday.h:368
weekday_last
Definition weekday.h:439
ETL_CONSTEXPR14 weekday_last(const etl::chrono::weekday &wd_) ETL_NOEXCEPT
Construct from unsigned.
Definition weekday.h:445
ETL_CONSTEXPR14 weekday_last(const etl::chrono::weekday_last &other) ETL_NOEXCEPT
Copy constructor.
Definition weekday.h:453
ETL_NODISCARD ETL_CONSTEXPR14 etl::chrono::weekday weekday() const ETL_NOEXCEPT
Get weekday.
Definition weekday.h:471
ETL_CONSTEXPR14 etl::chrono::weekday_last & operator=(const etl::chrono::weekday_last &rhs) ETL_NOEXCEPT
Assignment operator.
Definition weekday.h:461
ETL_NODISCARD ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT
Returns true if the weekday is valid.
Definition weekday.h:479
weekday
Definition weekday.h:54
ETL_NODISCARD ETL_CONSTEXPR14 unsigned iso_encoding() const ETL_NOEXCEPT
Get the ISO encoding of the weekday.
Definition weekday.h:221
ETL_NODISCARD ETL_CONSTEXPR14 etl::chrono::weekday_indexed operator[](unsigned index) const ETL_NOEXCEPT
Index operator from index.
Definition weekday.h:500
static ETL_NODISCARD ETL_CONSTEXPR14 unsigned max() ETL_NOEXCEPT
Definition weekday.h:203
static ETL_NODISCARD ETL_CONSTEXPR14 unsigned min() ETL_NOEXCEPT
Definition weekday.h:193
ETL_NODISCARD ETL_CONSTEXPR14 bool is_weekend() const ETL_NOEXCEPT
Returns true if the day is a weekend.
Definition weekday.h:242
ETL_NODISCARD ETL_CONSTEXPR14 unsigned c_encoding() const ETL_NOEXCEPT
Get the C encoding of the weekday.
Definition weekday.h:212
ETL_CONSTEXPR weekday() ETL_NOEXCEPT
Default constructor.
Definition weekday.h:60
ETL_CONSTEXPR14 weekday(const etl::chrono::local_days &ld) ETL_NOEXCEPT
Construct from local_days.
Definition weekday.h:89
ETL_CONSTEXPR14 etl::chrono::weekday & operator++() ETL_NOEXCEPT
Pre-increment operator.
Definition weekday.h:118
ETL_CONSTEXPR14 etl::chrono::weekday & operator-=(const etl::chrono::days &ds) ETL_NOEXCEPT
Minus-equals operator subtracting etl::chrono::days.
Definition weekday.h:172
ETL_CONSTEXPR14 weekday(const etl::chrono::weekday &other) ETL_NOEXCEPT
Copy constructor.
Definition weekday.h:100
ETL_CONSTEXPR14 weekday(const etl::chrono::sys_days &sd) ETL_NOEXCEPT
Construct from sys_days.
Definition weekday.h:76
ETL_CONSTEXPR14 etl::chrono::weekday & operator=(const etl::chrono::weekday &rhs) ETL_NOEXCEPT
Assignment operator.
Definition weekday.h:108
ETL_CONSTEXPR14 etl::chrono::weekday & operator+=(const etl::chrono::days &ds) ETL_NOEXCEPT
Plus-equals operator adding etl::chrono::days.
Definition weekday.h:162
ETL_CONSTEXPR14 etl::chrono::weekday & operator--() ETL_NOEXCEPT
Pre-decrement operator.
Definition weekday.h:140
ETL_CONSTEXPR weekday(unsigned value_) ETL_NOEXCEPT
Construct from unsigned.
Definition weekday.h:68
ETL_NODISCARD ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT
Returns true if the weekday is within the valid 1 to 31 range.
Definition weekday.h:183
bitset_ext
Definition absolute.h:39
Definition last_spec.h:40