9 int const era = (y >= 0 ? y : y - 399) / 400;
10 unsigned const yoe =
static_cast<unsigned>(y - era * 400);
11 unsigned const doy = (153 * (m > 2 ? m - 3 : m + 9) + 2) / 5 + d - 1;
12 unsigned const doe = yoe * 365 + yoe / 4 - yoe / 100 + doy;
13 return era * 146097 +
static_cast<int>(doe) - 719468;
18 const int32_t era = int32_t((z >= 0 ? z : z - 146096) / 146097);
19 unsigned const doe =
static_cast<unsigned>(z - era * 146097);
20 unsigned const yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365;
21 const int32_t y =
static_cast<int32_t
>(yoe) + era * 400;
22 unsigned const doy = doe - (365 * yoe + yoe / 4 - yoe / 100);
23 unsigned const mp = (5 * doy + 2) / 153;
24 unsigned const d = doy - (153 * mp + 2) / 5 + 1;
25 unsigned const m = mp < 10 ? mp + 3 : mp - 9;
26 return year_month_day{int32_t(y + (m <= 2)), uint16_t(m), uint16_t(d)};
30 auto difference =
days_from_civil(v.year, v.month, v.day) - base.to_days();
31 difference = std::clamp(difference, int64_t(0), int64_t(std::numeric_limits<uint16_t>::max()) - 1);
36 int64_t
count = base.to_days() + (value - 1);
45 return bool(d) && start.
to_days() + (d.to_raw_value() - 1) < end.
to_days();
53 return (year % 400 == 0) || ((year % 4 == 0) && (year % 100 == 0));
constexpr int64_t to_days() const noexcept
absolute_time_point() noexcept=default
year_month_day to_ymd(absolute_time_point base) const noexcept
constexpr date() noexcept=default
int32_t days_difference(year_month_day start, year_month_day end)
bool is_leap_year(int32_t year)
constexpr int days_from_civil(int y, unsigned m, unsigned d) noexcept
bool is_playable_date(date d, absolute_time_point start, absolute_time_point end)
constexpr year_month_day civil_from_days(int64_t z) noexcept