MT Core (C++)
Core library for replacing C++ standard in project usage
|
Wrapper for a date with a time component and timezone. More...
#include <core.hpp>
Public Types | |
using | CalendarSystem = Calendar |
Public Member Functions | |
constexpr bool | is_valid () const |
Checks that a date is valid. | |
constexpr CalDateTimeZoned | nearest_valid () const |
Moves the date to the nearest valid date. | |
constexpr | operator CalDate< Calendar > () const noexcept |
constexpr | operator CalDateTime< Calendar > () const noexcept |
constexpr Segments | time_segments () const noexcept |
template<typename Other> | |
constexpr | operator CalDateTimeZoned< Other > () const noexcept |
constexpr CalDateTimeZoned | to_utc () const noexcept |
Convert to UTC timezone. | |
constexpr CalDateTimeZoned | to_timezone (const TimeZone &tz) const noexcept |
Convert to a specific timezone. | |
template<typename Other> | |
constexpr std::partial_ordering | operator<=> (const CalDateTimeZoned< Other > &o) const |
template<typename Other> | |
constexpr auto | operator== (const CalDateTimeZoned< Other > &o) const -> bool |
template<typename Other> | |
constexpr auto | operator!= (const CalDateTimeZoned< Other > &o) const -> bool |
template<typename Other> | |
constexpr auto | operator<= (const CalDateTimeZoned< Other > &o) const -> bool |
template<typename Other> | |
constexpr auto | operator>= (const CalDateTimeZoned< Other > &o) const -> bool |
template<typename Other> | |
constexpr auto | operator< (const CalDateTimeZoned< Other > &o) const -> bool |
template<typename Other> | |
constexpr auto | operator> (const CalDateTimeZoned< Other > &o) const -> bool |
constexpr DayOfWeek | day_of_week () const |
Gets the day of week for a date. | |
constexpr CalDateTimeZoned | add_days (const i32 days) const |
Adds n days to a date. | |
constexpr CalDateTimeZoned | sub_days (const i32 days) const |
Subtracts n days from a date. | |
template<typename Other> | |
constexpr i32 | day_difference (const CalDateTimeZoned< Other > &other) const |
Difference between two dates in days. | |
constexpr CalDateTimeZoned | nth_week_day (const i32 n, const DayOfWeek k) const |
Gets the nth day of week. | |
constexpr CalDateTimeZoned | day_of_week_before (const DayOfWeek k) const |
Gets the day of week before current date. | |
constexpr CalDateTimeZoned | day_of_week_after (const DayOfWeek k) const |
Gets the day of week after the current date. | |
constexpr CalDateTimeZoned | day_of_week_nearest (const DayOfWeek k) const |
Gets the day of week nearest to the current date. | |
constexpr CalDateTimeZoned | day_of_week_on_or_before (const DayOfWeek k) const |
Gets the day of week on or before the current date. | |
constexpr CalDateTimeZoned | day_of_week_on_or_after (const DayOfWeek k) const |
Gets the day of week on or after the current date. | |
constexpr CalDateTimeZoned | first_week_day (const DayOfWeek k) const |
Gets the first week day in a month (assuming current date is the start of the month) | |
constexpr CalDateTimeZoned | last_week_day (const DayOfWeek k) const |
Gets the last week day in a month (assuming current date is the end of the month) | |
template<typename Other> | |
auto | positions_in_range (Allocator &alloc, const CalDateTime< Other > &end, i32 pthMoment, i32 cDayCycle, i32 delta) const -> Result< ArrayList< CalDateTimeZoned >, AllocationError > |
Return the cyclic positions in the range of the current date to the end date (exclusive) Used to collect all occurrences of events (e.g. | |
i32 | day_of_m_cycle (i32 m, i32 offset) const |
Gets which day the current date occurs in an m-length ("month") cycle. | |
auto | kth_day_of_m_cycle_on_or_before (i32 k, i32 m, i32 offset) const noexcept -> CalDateTimeZoned |
Finds the kth day of the m-cycle that occurs on or before the current date. | |
auto | kth_day_of_m_cycle_before (i32 k, i32 m, i32 offset) const noexcept -> CalDateTimeZoned |
Finds the kth day of the m-cycle that occurs before the current date. | |
auto | kth_day_of_m_cycle_on_or_after (i32 k, i32 m, i32 offset) const noexcept -> CalDateTimeZoned |
Finds the kth day of the m-cycle that occurs on or after the current date. | |
auto | kth_day_of_m_cycle_after (i32 k, i32 m, i32 offset) const noexcept -> CalDateTimeZoned |
Finds the kth day of the m-cycle that occurs after the current date. | |
auto | kth_day_of_m_cycle_nearest (i32 k, i32 m, i32 offset) const noexcept -> CalDateTimeZoned |
Finds the kth day of the m-cycle that occurs nearest the current date. | |
Public Attributes | |
CalDateTime< Calendar > | dateTime |
TimeZone | zone = zone::utc() |
Wrapper for a date with a time component and timezone.
Calendar | Calendar system used for date. If no time is built in, will use Segments. |
Definition at line 912 of file calendars/mtcore_calendars/core.hpp.
using mtcore::calendars::CalDateTimeZoned< Calendar >::CalendarSystem = Calendar |
Definition at line 914 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Adds n days to a date.
Definition at line 1042 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Difference between two dates in days.
Definition at line 1049 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscard |
Gets which day the current date occurs in an m-length ("month") cycle.
m | Length of cycle |
offset | Offset for start of cycle |
Definition at line 1138 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Gets the day of week for a date.
Definition at line 1039 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Gets the day of week after the current date.
Definition at line 1064 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Gets the day of week before current date.
Definition at line 1059 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Gets the day of week nearest to the current date.
Definition at line 1069 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Gets the day of week on or after the current date.
Definition at line 1079 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Gets the day of week on or before the current date.
Definition at line 1074 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Gets the first week day in a month (assuming current date is the start of the month)
Definition at line 1084 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Checks that a date is valid.
Definition at line 919 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardnoexcept |
Finds the kth day of the m-cycle that occurs after the current date.
k | The kth day of the m-cycle |
m | The number of days in the m-cycle |
offset | The offset of the m-cycle |
Definition at line 1180 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardnoexcept |
Finds the kth day of the m-cycle that occurs before the current date.
k | The kth day of the m-cycle |
m | The number of days in the m-cycle |
offset | The offset of the m-cycle |
Definition at line 1158 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardnoexcept |
Finds the kth day of the m-cycle that occurs nearest the current date.
k | The kth day of the m-cycle |
m | The number of days in the m-cycle |
offset | The offset of the m-cycle |
Definition at line 1191 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardnoexcept |
Finds the kth day of the m-cycle that occurs on or after the current date.
k | The kth day of the m-cycle |
m | The number of days in the m-cycle |
offset | The offset of the m-cycle |
Definition at line 1169 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardnoexcept |
Finds the kth day of the m-cycle that occurs on or before the current date.
k | The kth day of the m-cycle |
m | The number of days in the m-cycle |
offset | The offset of the m-cycle |
Definition at line 1147 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Gets the last week day in a month (assuming current date is the end of the month)
Definition at line 1089 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Moves the date to the nearest valid date.
Definition at line 924 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
|
inlinenodiscardconstexprnoexcept |
Definition at line 932 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexprnoexcept |
Definition at line 933 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexprnoexcept |
Definition at line 937 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Definition at line 1013 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
|
inlinenodiscardconstexpr |
|
inlinenodiscardconstexpr |
Definition at line 1001 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Definition at line 1008 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
|
inlinenodiscardconstexpr |
|
inlinenodiscard |
Return the cyclic positions in the range of the current date to the end date (exclusive) Used to collect all occurrences of events (e.g.
holidays) in an interval of time (e.g. a Gregorian year)
Assumes $0 \le pthMoment \lt cDayCycle$
alloc | Allocator to use |
end | End of the cyclic range |
pthMoment | Starting pth moment search. First result on or after a given moment of the pth moment (basically the cycle start) |
cDayCycle | The number of days in the occurrence day cycle (basically the cycle length) |
delta | Congruent modulo of cDayCycle to the position of RdDate{0} in the repeating cycle (basically the cycle modulo offset) |
Definition at line 1109 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Subtracts n days from a date.
Definition at line 1045 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexprnoexcept |
Definition at line 934 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexprnoexcept |
Convert to a specific timezone.
Definition at line 971 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexprnoexcept |
Convert to UTC timezone.
Definition at line 942 of file calendars/mtcore_calendars/core.hpp.
CalDateTime<Calendar> mtcore::calendars::CalDateTimeZoned< Calendar >::dateTime |
Definition at line 915 of file calendars/mtcore_calendars/core.hpp.
TimeZone mtcore::calendars::CalDateTimeZoned< Calendar >::zone = zone::utc() |
Definition at line 916 of file calendars/mtcore_calendars/core.hpp.