MT Core (C++)
Core library for replacing C++ standard in project usage
Loading...
Searching...
No Matches
mtcore::calendars::systems::Egyptian Struct Reference

Represents the ancient Egyptian calendaring system. More...

#include <egyptian.hpp>

Collaboration diagram for mtcore::calendars::systems::Egyptian:

Public Types

enum class  Month {
  Thoth = 1 , Phaophi , Athyr , Choiak ,
  Tybi , Mechir , Phamenoth , Pharmuthi ,
  Pachon , Payni , Epiphi , Mesori ,
  epagomenae
}
 

Public Member Functions

constexpr auto operator<=> (const Egyptian &o) const noexcept
 
constexpr Fixed to_fixed () const noexcept
 

Static Public Member Functions

static constexpr Egyptian from_fixed (const Fixed &rdDate) noexcept
 

Public Attributes

AstronomicalYear year = 0
 Year of the date.
 
Month month = Month::Thoth
 MONTH of the year (1-13)
 
u8 day = 1
 Day of the month: 1-30 (epagomenae 1-5)
 

Static Public Attributes

static constexpr auto EPOCH = EGYPTIAN_EPOCH
 
static constexpr std::string_view name = "Egyptian"
 

Detailed Description

Represents the ancient Egyptian calendaring system.

The Egyptian calendars has 13 months, with the first 12 months being 30 days and the last month (the epagomenae) being 5 days. Note that the epagomenae (month 13) does not have a name.

Definition at line 33 of file egyptian.hpp.

Member Enumeration Documentation

◆ Month

Enumerator
Thoth 
Phaophi 
Athyr 
Choiak 
Tybi 
Mechir 
Phamenoth 
Pharmuthi 
Pachon 
Payni 
Epiphi 
Mesori 
epagomenae 

Definition at line 36 of file egyptian.hpp.

36 {
37 Thoth = 1,
38 Phaophi,
39 Athyr,
40 Choiak,
41 Tybi,
42 Mechir,
43 Phamenoth,
44 Pharmuthi,
45 Pachon,
46 Payni,
47 Epiphi,
48 Mesori,
49
50 epagomenae
51 };

Member Function Documentation

◆ from_fixed()

static constexpr Egyptian mtcore::calendars::systems::Egyptian::from_fixed ( const Fixed & rdDate)
inlinestaticnodiscardconstexprnoexcept

Definition at line 79 of file egyptian.hpp.

79 {
80 const auto days = rdDate.day - EPOCH;
81 const auto egyptianYear = math::floor<double, int64_t>(static_cast<double>(days) / 365.0) + 1;
82 const auto egyptianMonth = math::floor<double, int64_t>(math::mod(static_cast<double>(days), 365) / 30.0) + 1;
83 const auto egyptianDay = days - 365 * (egyptianYear - 1) - 30 * (egyptianMonth - 1) + 1;
84 return Egyptian{static_cast<decltype(year)>(egyptianYear), static_cast<decltype(month)>(egyptianMonth),
85 static_cast<decltype(day)>(egyptianDay)};
86 }
constexpr R floor(T num) noexcept
Floors a number with support for constexpr and fast runtime compilation.
constexpr Res mod(L left, R right) noexcept
Calculates the mathematical mod of two numbers.
AstronomicalYear year
Year of the date.
Definition egyptian.hpp:56
u8 day
Day of the month: 1-30 (epagomenae 1-5)
Definition egyptian.hpp:64
Month month
MONTH of the year (1-13)
Definition egyptian.hpp:60
Here is the call graph for this function:

◆ operator<=>()

auto mtcore::calendars::systems::Egyptian::operator<=> ( const Egyptian & o) const
inlinenodiscardconstexprnoexcept

Definition at line 66 of file egyptian.hpp.

66 {
67 if (const auto c = year <=> o.year; c != std::strong_ordering::equivalent) {
68 return c;
69 }
70 if (const auto c = month <=> o.month; c != std::strong_ordering::equivalent) {
71 return c;
72 }
73 if (const auto c = day <=> o.day; c != std::strong_ordering::equivalent) {
74 return c;
75 }
76 return std::strong_ordering::equivalent;
77 }

◆ to_fixed()

Fixed mtcore::calendars::systems::Egyptian::to_fixed ( ) const
inlinenodiscardconstexprnoexcept

Definition at line 88 of file egyptian.hpp.

88 {
89 return Fixed{EPOCH + ((365 * (static_cast<i32>(year) - 1) + 30 * (static_cast<i32>(month) - 1) +
90 static_cast<i32>(day - 1)))};
91 }
int32_t i32
Alias for 32-bit ints.

Member Data Documentation

◆ day

u8 mtcore::calendars::systems::Egyptian::day = 1

Day of the month: 1-30 (epagomenae 1-5)

Definition at line 64 of file egyptian.hpp.

◆ EPOCH

auto mtcore::calendars::systems::Egyptian::EPOCH = EGYPTIAN_EPOCH
staticconstexpr

Definition at line 34 of file egyptian.hpp.

◆ month

Month mtcore::calendars::systems::Egyptian::month = Month::Thoth

MONTH of the year (1-13)

Definition at line 60 of file egyptian.hpp.

◆ name

std::string_view mtcore::calendars::systems::Egyptian::name = "Egyptian"
staticconstexpr

Definition at line 35 of file egyptian.hpp.

◆ year

AstronomicalYear mtcore::calendars::systems::Egyptian::year = 0

Year of the date.

Definition at line 56 of file egyptian.hpp.


The documentation for this struct was generated from the following file: