3#ifndef TETL_CHRONO_WEEKDAY_HPP
4#define TETL_CHRONO_WEEKDAY_HPP
21 constexpr explicit weekday(
unsigned wd) noexcept
27 : _wd{weekday_from_days(dp.time_since_epoch().count())}
32 : _wd{weekday_from_days(dp.time_since_epoch().count())}
58 [[nodiscard]]
constexpr auto c_encoding() const noexcept ->
unsigned {
return _wd; }
60 [[nodiscard]]
constexpr auto iso_encoding() const noexcept ->
unsigned {
return _wd == 0U ? 7U : _wd; }
62 [[nodiscard]]
constexpr auto ok() const noexcept ->
bool {
return _wd < 7U; }
72 return lhs.c_encoding() == rhs.c_encoding();
76 [[nodiscard]]
static constexpr auto weekday_from_days(
int tp)
noexcept ->
etl::uint8_t
78 return static_cast<etl::uint8_t>(tp >= -4 ? (tp + 4) % 7 : (tp + 5) % 7 + 6);
86 return weekday{
static_cast<unsigned>((
static_cast<int32_t>(lhs.c_encoding()) + rhs.count()) % 7)};
93 return weekday{
static_cast<unsigned>((
static_cast<int32_t>(lhs.c_encoding()) - rhs.count()) % 7)};
constexpr auto count(InputIt first, InputIt last, T const &value) -> typename iterator_traits< InputIt >::difference_type
Returns the number of elements in the range [first, last) satisfying specific criteria....
Definition count.hpp:21
local_time< etl::chrono::days > local_days
Definition local_t.hpp:27
constexpr auto operator+(day const &d, days const &ds) noexcept -> day
Definition day.hpp:92
duration< int_least32_t, ratio< 86400 > > days
Signed integer type of at least 25 bits.
Definition duration.hpp:365
constexpr auto Saturday
Definition weekday.hpp:108
sys_time< chrono::days > sys_days
Definition system_clock.hpp:39
constexpr auto Friday
Definition weekday.hpp:107
constexpr auto Wednesday
Definition weekday.hpp:105
constexpr auto Tuesday
Definition weekday.hpp:104
constexpr auto operator-(day const &d, days const &ds) noexcept -> day
Definition day.hpp:102
constexpr auto Monday
Definition weekday.hpp:103
constexpr auto Thursday
Definition weekday.hpp:106
constexpr auto Sunday
Definition weekday.hpp:102
TETL_BUILTIN_INT32 int32_t
Signed integer type with width of exactly 32 bits.
Definition int_t.hpp:17
TETL_BUILTIN_UINT8 uint8_t
Unsigned integer type with width of exactly 8 bits.
Definition uint_t.hpp:11
TETL_BUILTIN_INT32 int_least32_t
Signed integer type with width of at least 32 bits.
Definition int_least_t.hpp:17
last_spec is an empty tag type that is used in conjunction with other calendar types to indicate the ...
Definition last_spec.hpp:19
Definition weekday_indexed.hpp:11
Definition weekday_last.hpp:11
Definition weekday.hpp:18
constexpr auto operator--(int) noexcept -> weekday
Definition weekday.hpp:42
constexpr auto operator--() noexcept -> weekday &
Definition weekday.hpp:40
constexpr auto ok() const noexcept -> bool
Definition weekday.hpp:62
constexpr weekday(sys_days const &dp) noexcept
Definition weekday.hpp:26
constexpr auto operator+=(days const &d) noexcept -> weekday &
Definition weekday.hpp:44
constexpr auto operator++(int) noexcept -> weekday
Definition weekday.hpp:38
constexpr auto operator++() noexcept -> weekday &
Definition weekday.hpp:36
constexpr auto iso_encoding() const noexcept -> unsigned
Definition weekday.hpp:60
constexpr auto c_encoding() const noexcept -> unsigned
Definition weekday.hpp:58
constexpr weekday(unsigned wd) noexcept
Definition weekday.hpp:21
constexpr auto operator-=(days const &d) noexcept -> weekday &
Definition weekday.hpp:51
constexpr auto operator[](unsigned index) const noexcept -> weekday_indexed
Definition weekday_indexed.hpp:39
friend constexpr auto operator==(weekday const &lhs, weekday const &rhs) noexcept -> bool
Definition weekday.hpp:70
constexpr weekday(local_days const &dp) noexcept
Definition weekday.hpp:31