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 =
static_cast<unsigned char>((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);
182 ETL_NODISCARD ETL_CONSTEXPR14
bool ok() const ETL_NOEXCEPT
192 static ETL_CONSTEXPR14
unsigned min() ETL_NOEXCEPT
202 static ETL_CONSTEXPR14
unsigned max() ETL_NOEXCEPT
210 ETL_NODISCARD ETL_CONSTEXPR14
unsigned c_encoding() const ETL_NOEXCEPT
218 ETL_NODISCARD ETL_CONSTEXPR14
unsigned iso_encoding() const ETL_NOEXCEPT
220 return (value == 0U) ? 7U : value;
236 ETL_NODISCARD ETL_CONSTEXPR14
bool is_weekend() const ETL_NOEXCEPT
252 return (wd1.c_encoding() == wd2.c_encoding());
260 return !(wd1 == wd2);
269 int delta = ds.count() % 7;
271 unsigned int value = wd.c_encoding();
276 value +=
static_cast<unsigned int>(delta);
297 return m + etl::chrono::days(-ds.count());
306 if (wd1.ok() && wd2.ok())
308 int diff =
static_cast<int>(wd1.c_encoding()) -
static_cast<int>(wd2.c_encoding());
310 return etl::chrono::days((diff + 7) % 7);
313 return etl::chrono::days(0);
319 inline constexpr etl::chrono::weekday Tuesday{2U};
320 inline constexpr etl::chrono::weekday Wednesday{3U};
321 inline constexpr etl::chrono::weekday Thursday{4U};
322 inline constexpr etl::chrono::weekday Friday{5U};
323 inline constexpr etl::chrono::weekday Saturday{6U};
325 static ETL_CONSTANT etl::chrono::weekday Sunday{0U};
326 static ETL_CONSTANT etl::chrono::weekday Monday{1U};
327 static ETL_CONSTANT etl::chrono::weekday Tuesday{2U};
328 static ETL_CONSTANT etl::chrono::weekday Wednesday{3U};
329 static ETL_CONSTANT etl::chrono::weekday Thursday{4U};
330 static ETL_CONSTANT etl::chrono::weekday Friday{5U};
331 static ETL_CONSTANT etl::chrono::weekday Saturday{6U};
355 , i(
static_cast<uint_least8_t
>(index_))
370 ETL_NODISCARD ETL_NODISCARD ETL_CONSTEXPR14
unsigned index() const ETL_NOEXCEPT
378 ETL_NODISCARD ETL_NODISCARD ETL_CONSTEXPR14
bool ok() const ETL_NOEXCEPT
380 return wd.ok() && (i >= 1U) && (i <= 5U);
394 return (wd1.weekday() == wd2.weekday()) && (wd1.index() == wd2.index());
402 return !(wd1 == wd2);
449 ETL_NODISCARD ETL_CONSTEXPR14
bool ok() const ETL_NOEXCEPT
464 return (wd1.weekday() == wd2.weekday());
487#if ETL_USING_8BIT_TYPES
494 const uint8_t* p =
reinterpret_cast<const uint8_t*
>(&value);
496 return etl::private_hash::generic_hash<size_t>(p, p +
sizeof(
unsigned));
504#if ETL_USING_8BIT_TYPES
508 size_t operator()(
const etl::chrono::weekday_indexed& wdi)
const
511 unsigned int b = wdi.
index();
513 uint8_t buffer[
sizeof(a) +
sizeof(b)];
515 memcpy(buffer, &a,
sizeof(a));
516 memcpy(buffer +
sizeof(a), &b,
sizeof(b));
518 return etl::private_hash::generic_hash<size_t>(buffer, buffer +
sizeof(a) +
sizeof(b));
526#if ETL_USING_8BIT_TYPES
530 size_t operator()(
const etl::chrono::weekday_last& wdl)
const
532 return etl::hash<etl::chrono::weekday>()(wdl.
weekday());
weekday_indexed
Definition weekday.h:338
ETL_NODISCARD ETL_NODISCARD ETL_CONSTEXPR14 etl::chrono::weekday weekday() const ETL_NOEXCEPT
Get weekday.
Definition weekday.h:362
ETL_CONSTEXPR14 weekday_indexed(const etl::chrono::weekday &wd_, unsigned index_) ETL_NOEXCEPT
Construct from weekday and index.
Definition weekday.h:353
ETL_NODISCARD ETL_NODISCARD ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT
Returns true if the weekday and index are valid.
Definition weekday.h:378
ETL_NODISCARD ETL_NODISCARD ETL_CONSTEXPR14 unsigned index() const ETL_NOEXCEPT
Get index.
Definition weekday.h:370
ETL_CONSTEXPR weekday_indexed() ETL_NOEXCEPT
Default constructor.
Definition weekday.h:344
weekday_last
Definition weekday.h:409
ETL_CONSTEXPR14 weekday_last(const etl::chrono::weekday &wd_) ETL_NOEXCEPT
Construct from unsigned.
Definition weekday.h:415
ETL_CONSTEXPR14 weekday_last(const etl::chrono::weekday_last &other) ETL_NOEXCEPT
Copy constructor.
Definition weekday.h:423
ETL_NODISCARD ETL_CONSTEXPR14 etl::chrono::weekday weekday() const ETL_NOEXCEPT
Get weekday.
Definition weekday.h:441
ETL_CONSTEXPR14 etl::chrono::weekday_last & operator=(const etl::chrono::weekday_last &rhs) ETL_NOEXCEPT
Assignment operator.
Definition weekday.h:431
ETL_NODISCARD ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT
Returns true if the weekday is valid.
Definition weekday.h:449
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:218
ETL_NODISCARD ETL_CONSTEXPR14 etl::chrono::weekday_indexed operator[](unsigned index) const ETL_NOEXCEPT
Index operator from index.
Definition weekday.h:470
static ETL_NODISCARD ETL_CONSTEXPR14 unsigned max() ETL_NOEXCEPT
Definition weekday.h:202
static ETL_NODISCARD ETL_CONSTEXPR14 unsigned min() ETL_NOEXCEPT
Definition weekday.h:192
ETL_NODISCARD ETL_CONSTEXPR14 bool is_weekend() const ETL_NOEXCEPT
Returns true if the day is a weekend.
Definition weekday.h:236
ETL_NODISCARD ETL_CONSTEXPR14 unsigned c_encoding() const ETL_NOEXCEPT
Get the C encoding of the weekday.
Definition weekday.h:210
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 etl::chrono::weekday operator++(int) ETL_NOEXCEPT
Post-increment operator.
Definition weekday.h:128
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--(int) ETL_NOEXCEPT
Post-decrement operator.
Definition weekday.h:150
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:182
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
Equality operator.
Definition day.h:166
ETL_CONSTEXPR14 bool operator!=(const etl::chrono::day &d1, const etl::chrono::day &d2) ETL_NOEXCEPT
Inequality operator.
Definition day.h:174
bitset_ext
Definition absolute.h:40
Definition last_spec.h:40