Class astrea::astro::Date¶
ClassList > astrea > astro > Date
Class representing a date in the astrea astro library. More...
#include <Date.hpp>
Public Functions¶
| Type | Name |
|---|---|
| Date (const JulianDate & jdate=J2000) Construct a Date object from a JulianDate. |
|
| Date (const std::string & epoch, const std::string & format="%Y-%m-%d %H:%M:%S") Construct a Date object from a JulianDate. |
|
| std::string | epoch () const Get the epoch of this Date object as a string. |
| Angle | gmst () const Get the Greenwich Mean Sidereal Time (GMST) for this Date object. |
| std::chrono::time_point< std::chrono::gps_clock > | gps () const Get the Date in GPS clock format. |
| std::chrono::time_point< Clock_T > | in_clock () const Get the Date in a specified clock format. |
| JulianDate | jd () const Get the Julian date representation of this Date object. |
| double | jdn () const Get the Julian date in days since the epoch. |
| std::chrono::duration< double, std::ratio< 86400 > > | mjd () const Get the Modified Julian Date (MJD) representation of thisDate object. |
| Date | operator+ (const Time & time) const Add a Time object to this Date object. |
| Date & | operator+= (const Time & time) Add a Time object to this Date object in place. |
| Date | operator- (const Time & time) const Subtract a Time object from this Date object. |
| Time | operator- (const Date & other) const Subtract another Date object from thisDate object. |
| Date & | operator-= (const Time & time) Subtract a Time object from this Date object in place. |
| auto | operator<=> (const Date & other) const Compare this Date object with anotherDate object. |
| bool | operator== (const Date & other) const Check if this Date object is equal to anotherDate object. |
| std::chrono::time_point< std::chrono::system_clock > | sys () const Get the Date in TT clock format. |
| std::chrono::time_point< std::chrono::tai_clock > | tai () const Get the Date in TAI clock format. |
| std::chrono::time_point< std::chrono::utc_clock > | utc () const Get the Date in UTC clock format. |
| ~Date () = default Destructor for Date . |
Public Static Functions¶
| Type | Name |
|---|---|
| const Date | now () noexcept Get the current date and time as a Date object. |
Detailed Description¶
This class provides functionality for handling dates, including conversions to and from Julian dates, sidereal time calculations, and various clock conversions.
Public Functions Documentation¶
function Date [1/2]¶
Construct a Date object from a JulianDate.
Parameters:
jdateThe JulianDate to initialize the Date object.
function Date [2/2]¶
Construct a Date object from a JulianDate.
inline astrea::astro::Date::Date (
const std::string & epoch,
const std::string & format="%Y-%m-%d %H:%M:%S"
)
Parameters:
epochThe JulianDate to initialize the Date object.formatThe format of the date string, default is "%Y-%m-%d %H:%M:%S".
function epoch¶
Get the epoch of this Date object as a string.
Returns:
std::string The epoch of this Date object formatted as a string.
function gmst¶
Get the Greenwich Mean Sidereal Time (GMST) for this Date object.
Returns:
Angle The Greenwich Mean Sidereal Time for this Date object.
function gps¶
Get the Date in GPS clock format.
Returns:
std::chrono::time_point<std::chrono::gps_clock>
function in_clock¶
Get the Date in a specified clock format.
template<typename Clock_T>
inline std::chrono::time_point< Clock_T > astrea::astro::Date::in_clock () const
Template parameters:
Clock_TThe clock type to convert to.
Returns:
std::chrono::time_point<Clock_T> The Date in the specified clock format.
function jd¶
Get the Julian date representation of this Date object.
Returns:
JulianDate The Julian date representation of this Date object.
function jdn¶
Get the Julian date in days since the epoch.
Returns:
double The Julian date in days since the epoch.
function mjd¶
Get the Modified Julian Date (MJD) representation of thisDate object.
Returns:
std::chrono::duration<double, std::ratio<86400>> The Modified Julian Date representation of this Date object.
function operator+¶
Add a Time object to this Date object.
Parameters:
timeThe Time object to add.
Returns:
Date A new Date object representing the result of the addition.
function operator+=¶
Add a Time object to this Date object in place.
Parameters:
timeThe Time object to add.
Returns:
Date& A reference to this Date object after the addition.
function operator-¶
Subtract a Time object from this Date object.
Parameters:
timeThe Time object to subtract.
Returns:
Date A new Date object representing the result of the subtraction.
function operator-¶
Subtract another Date object from thisDate object.
Parameters:
otherThe Date object to subtract.
Returns:
Time A Time object representing the difference between the two dates.
function operator-=¶
Subtract a Time object from this Date object in place.
Parameters:
timeThe Time object to subtract.
Returns:
Date& A reference to this Date object after the subtraction.
function operator<=>¶
Compare this Date object with anotherDate object.
Parameters:
otherThe Date object to compare with.
Returns:
std::strong_ordering A strong ordering result indicating the comparison.
function operator==¶
Check if this Date object is equal to anotherDate object.
Parameters:
otherThe Date object to compare with.
Returns:
bool True if the two Date objects are equal, false otherwise.
function sys¶
Get the Date in TT clock format.
Returns:
std::chrono::time_point<std::chrono::tt_clock>
Get the Date in sys clock format.
Returns:
std::chrono::time_point<std::chrono::system_clock>
function tai¶
Get the Date in TAI clock format.
Returns:
std::chrono::time_point<std::chrono::tai_clock>
function utc¶
Get the Date in UTC clock format.
Returns:
std::chrono::time_point<std::chrono::utc_clock>
function ~Date¶
Destructor for Date .
Public Static Functions Documentation¶
function now¶
Get the current date and time as a Date object.
Returns:
const Date The current date and time.
The documentation for this class was generated from the following file astrea/astro/astro/time/Date.hpp