|
CelestialCalendar 1.0.0 · unreleased development @ 67a7c4c79a4a4a6aa7e703c9e6f0039ae34bee82
|
Namespaces | |
| namespace | detail |
| namespace | jieqi |
| namespace | lunar |
Classes | |
| struct | Datetime |
| Represents a date and a time in the form of year_month_day and hh_mm_ss. More... | |
Concepts | |
| concept | IsDuration |
| Checks if a type is of std::chrono::duration. | |
| concept | Fractionable |
| Checks if a type can cast to std::chrono::nanoseconds, which is the assumption of function fraction. | |
Typedefs | |
| using | days |
| using | seconds |
| using | nanoseconds |
| using | microseconds |
| using | system_clock |
| using | year_month_day |
| using | sys_days |
Functions | |
| template<IsDuration Duration> | |
| consteval auto | in_a_day () -> uint64_t |
| Returns the number of the given duration in a day. | |
| template<Fractionable Duration> | |
| constexpr auto | to_fraction (const Duration &elapsed) -> double |
| Returns the fraction of a day. | |
| constexpr auto | from_fraction (const double fraction) -> hh_mm_ss< nanoseconds > |
| Returns the nanoseconds of fraction days. | |
| constexpr auto | validate_fraction (const double fraction) -> double |
| Validate the fraction of a day, before any narrowing conversion happens. | |
| constexpr auto | add_seconds (const Datetime &dt, const double offset_sec) -> Datetime |
| Returns dt shifted by offset_sec seconds, carrying whole days into the date part. | |
| using calendar::days |
| using calendar::microseconds |
| using calendar::nanoseconds |
| using calendar::seconds |
| using calendar::sys_days |
| using calendar::system_clock |
| using calendar::year_month_day |
|
nodiscardconstexpr |
Returns dt shifted by offset_sec seconds, carrying whole days into the date part.
| dt | The datetime to shift. |
| offset_sec | The offset in seconds. Can be negative, and is not limited to one day. |
| std::invalid_argument | if offset_sec is not finite, or if the shifted date leaves std::chrono::year_month_day's representable years. |
|
nodiscardconstexpr |
Returns the nanoseconds of fraction days.
| fraction | The fraction. |
| std::invalid_argument | if fraction days do not fit an int64_t count of nanoseconds (which includes NaN and either infinity). |
|
nodiscardconsteval |
|
nodiscardconstexpr |
Returns the fraction of a day.
| elapsed | The elapsed time. |
| Duration | The type of input elapsed. |
| std::invalid_argument | if the nanosecond count is not representable or the input is not finite. |
|
nodiscardconstexpr |
Validate the fraction of a day, before any narrowing conversion happens.
| fraction | The fraction of a day, expected in [0.0, 1.0). |
| std::invalid_argument | if fraction is outside [0.0, 1.0). |