Reckoning.h header
#include <ew/core/Reckoning.h>
Namespace ew::core
Reckoning struct
struct ew::core::Reckoning
One way of dating the world (TL-13): a named calendar together with the moment its own count begins. Two cultures date the same instant differently – "Year 12 of the Republic" and "1270 AC" name the same day – because they keep the same passage of time from a different epoch (and often with different month names and an era label). A reckoning is exactly that pairing: its calendar supplies the structure (months, weekdays, era) and epochOffsetMinutes says where, on the project's own absolute timeline, this reckoning's year 1 begins.
Instants everywhere else in the app are absolute – minutes since the PROJECT epoch (the primary calendar's year 1, first month, first day, 00:00). A reckoning converts such an instant into its own dating by subtracting its epoch offset before handing the remainder to its calendar, so the SAME instant reads as a different date under each reckoning. The project's primary calendar is the reckoning with a zero offset and is not stored in this list; these are the ADDITIONAL regional reckonings a reader may switch the display into.
Value type: the project owns a list of them and it is persisted with the project metadata.
Members
QString ew::core::calendar::Reckoning::name
The reckoning's display name (e.g. "Republican Calendar", "Imperial Reckoning").
Calendar ew::core::calendar::Reckoning::calendar
The calendar this reckoning keeps: its months, weekday cycle, and era label. Often the same structure as the primary calendar with only a different era, but it may diverge entirely (a lunar reckoning beside a solar one), which is why a full calendar is carried rather than just an era string.
qint64 ew::core::calendar::Reckoning::epochOffsetMinutes = 0
The absolute instant – minutes since the PROJECT epoch – at which this reckoning's own epoch (its year 1, first month, first day, 00:00) falls. A reckoning whose count starts after the project epoch has a positive value, so the same instant carries a smaller year number under it; a reckoning that starts before the project epoch has a negative value.
bool operator==(const Reckoning &, const Reckoning &)=default
Value equality over all fields, so a no-op reckonings edit can be detected before pushing an undoable command.
CalendarDate ew::core::calendar::Reckoning::toDate(qint64 minutesSinceProjectEpoch) const
The date this reckoning assigns to the absolute instant minutesSinceProjectEpoch. Applying the epoch offset saturates at the qint64 limits rather than wrapping, since both the instant and the offset are read from the project file unvalidated.
qint64 ew::core::calendar::Reckoning::toInstant(const CalendarDate &date) const
The absolute instant (minutes since the project epoch) for a date date expressed in this reckoning – the inverse of toDate. Saturates at the qint64 limits (see toDate).
QString ew::core::calendar::Reckoning::format(qint64 minutesSinceProjectEpoch) const
A human-readable rendering of the absolute instant minutesSinceProjectEpoch in this reckoning (e.g. "3 Harvestmoon, Year 12 of the Republic").