![]() |
SuperNOVAS C++ API v1.6
High-precision C/C++ astrometry library
|
Type of calendar used for representing dates, such as Gregorian, Roman, or astronomical. More...
#include <supernovas.h>
Public Member Functions | |
| CalendarDate | date (const struct timespec *ts) const |
| Returns a new calendar date instance, in this calendar, for the given astronomical time specification. | |
| CalendarDate | date (double jd) const |
| Returns a new calendar date instance, in this calendar, for the specified Julian date. | |
| CalendarDate | date (int year, int month, int day, const TimeAngle &time=TimeAngle::zero()) const |
| Returns a new calendar date instance for the date and time specified in this calendar. | |
| CalendarDate | date (time_t t, long nanos=0) const |
| Returns a new calendar date instance, in this calendar, for the specified UNIX time. | |
| CalendarDate | parse_date (const std::string &str, enum novas_date_format fmt=NOVAS_YMD) const |
| Returns a new calendar date instance, in this calendar, for the specified string date / time representation, if possible, or else std::nullopt. | |
| std::string | to_string () const |
| Returns a string representation of this type of calendar. | |
| enum novas_calendar_type | type () const |
| Returns the type of this calendar, that is whether it is a Gregorian, Roman / Julian, or astronomical calendar. | |
| Public Member Functions inherited from supernovas::Validating | |
| bool | is_valid () const |
| Returns the previously set 'valid' stae of the implementing instance. | |
| operator bool () const | |
| Objects that implement Validating can be used in conditionals directly, without explicitly calling is_valid(). | |
Static Public Member Functions | |
| static Calendar | astronomical () |
| Returns a new astronomical calendar instance. | |
| static Calendar | gregorian () |
| Returns a new Gregorian calendar instance. | |
| static Calendar | roman () |
| Returns a new Roman / Julian calendar instance. | |
Additional Inherited Members | |
| Protected Member Functions inherited from supernovas::Validating | |
| Validating () | |
| dummy constructor; | |
| Protected Attributes inherited from supernovas::Validating | |
| bool | _valid = false |
| the state variable. | |
Type of calendar used for representing dates, such as Gregorian, Roman, or astronomical.
|
static |
Returns a new astronomical calendar instance.
The astronomical calendat is the conventional calendar of date, that is the Roman / Julian calendar prior to the Gregorian calendar reform of 1582; and the Gregorian calendar after the date of the reform.
References NOVAS_ASTRONOMICAL_CALENDAR.
Referenced by supernovas::Time::operator-(), and supernovas::Time::to_calendar_date().
| CalendarDate supernovas::Calendar::date | ( | const struct timespec * | ts | ) | const |
Returns a new calendar date instance, in this calendar, for the given astronomical time specification.
| ts | Pointer to the astronomical time specification |
References date().
| CalendarDate supernovas::Calendar::date | ( | double | jd | ) | const |
Returns a new calendar date instance, in this calendar, for the specified Julian date.
| jd | [day] Julian Day |
References supernovas::Validating::is_valid().
| CalendarDate supernovas::Calendar::date | ( | int | year, |
| int | month, | ||
| int | day, | ||
| const TimeAngle & | time = TimeAngle::zero() ) const |
Returns a new calendar date instance for the date and time specified in this calendar.
| year | [yr] calendar year |
| month | [month] calendar month [1:12] |
| day | [day] calendar day-of-month [1:31] |
| Time of observation and astronomical timescales | time of day |
References supernovas::Validating::is_valid().
Referenced by date(), parse_date(), and supernovas::Time::to_calendar_date().
| CalendarDate supernovas::Calendar::date | ( | time_t | t, |
| long | nanos = 0 ) const |
Returns a new calendar date instance, in this calendar, for the specified UNIX time.
| t | [s] UNIX time (seconds since the Gregorian date of January 1, 1970). |
| nanos | [ns] sub-second time component |
References supernovas::Unit::day, NOVAS_JD_J2000, supernovas::Unit::ns, and UNIX_UTC_J2000.
|
static |
Returns a new Gregorian calendar instance.
References NOVAS_GREGORIAN_CALENDAR.
| CalendarDate supernovas::Calendar::parse_date | ( | const std::string & | str, |
| enum novas_date_format | fmt = NOVAS_YMD ) const |
Returns a new calendar date instance, in this calendar, for the specified string date / time representation, if possible, or else std::nullopt.
| str | The string date / time specification. There is a lot of flexibility on what dates/times may be parsed. See novas_parse_date_format() for details. |
| fmt | The date representation, such as NOVAS_YMD, NOVAS_DMY, or NOVAS_MDY, specifying the order in which the year (Y), month (M), and day (D) components are expected in the input string representation. |
References date(), novas_parse_date_format(), and supernovas::CalendarDate::undefined().
|
static |
Returns a new Roman / Julian calendar instance.
References NOVAS_ROMAN_CALENDAR.
| std::string supernovas::Calendar::to_string | ( | ) | const |
Returns a string representation of this type of calendar.
References NOVAS_GREGORIAN_CALENDAR, and NOVAS_ROMAN_CALENDAR.
| enum novas_calendar_type supernovas::Calendar::type | ( | ) | const |
Returns the type of this calendar, that is whether it is a Gregorian, Roman / Julian, or astronomical calendar.
The astronomical calendat is the conventional calendar of date.