CppEphem
|
CEDate class handles conversion between different date formats. Date formats used (see CEDateType):
To set the date, use the CEDate::SetDate method.
Public Member Functions | |
CEDate (const CEDate &other) | |
Copy constructor. More... | |
CEDate (double date=CurrentJD(), CEDateType date_format=CEDateType::JD) | |
Constructor from some date format. More... | |
CEDate (std::vector< double > date) | |
Constructor from a set of Gregorian values. More... | |
int | Day () |
Get the Gregorian calendar day. More... | |
double | DayFraction () |
Get the Gregorian calendar day fraction. More... | |
double | dut1 (void) const |
Return dut1 based on the date represented by this object. More... | |
double | GetDate (CEDateType time_format=CEDateType::JD) const |
Return the date in a given format. More... | |
virtual double | GetSecondsSinceMidnight (const double &utc_offset=0.0) |
Method for getting the number of seconds since midnight. More... | |
virtual double | GetTime (const double &utc_offset=0.0) const |
Method for getting the current time. More... | |
virtual double | GetTime_UTC () const |
Method for getting the current UTC time. More... | |
virtual double | Gregorian () const |
Get the Gregorian calendar date formatted as a double. More... | |
virtual std::vector< double > | GregorianVect () |
Get the Gregorian calendar date formatted as a vector. More... | |
virtual double | JD () const |
Get the Julian date represented by this object. More... | |
virtual double | MJD () const |
Get the Modified Julian date represented by this object. More... | |
int | Month () |
Get the Gregorian calendar month. More... | |
operator double () | |
Overload of the CEDate object which allows the object to be treated as a 'double' representing the date formatted according to 'return_type_'. More... | |
operator double () const | |
Overload of the CEDate object which allows the object to be treated as a 'double' representing the date formatted according to 'return_type_'. More... | |
CEDate & | operator= (const CEDate &other) |
Copy assignent operator. More... | |
virtual void | SetDate (const double &date=CurrentJD(), const CEDateType &time_format=CEDateType::JD) |
Set the date based on an actual date and the desired time_format. More... | |
virtual void | SetDate (std::vector< double > date) |
Set the date based on an actual date and the desired time_format. More... | |
void | SetReturnType (CEDateType return_type) |
Set the return type from the overloaded 'operator double'. More... | |
double | xpolar (void) const |
Polar motion (x) for a given date. More... | |
int | Year () |
Get the Gregorian calendar year. More... | |
double | ypolar (void) const |
Polar motion (y) for a given date. More... | |
virtual | ~CEDate () |
Destructor. More... | |
Static Public Member Functions | |
static double | CurrentJD () |
Static method for getting the current Julian date. More... | |
static double | dut1 (const double &date, const CEDateType &date_type=CEDateType::JD) |
Return dut1 based on a given modified date. More... | |
static double | GetMJD2JDFactor () |
Gets the stored SOFA Julian date to Mod Julian date factor 'DJM0'. More... | |
static std::vector< double > | Gregorian2GregorianVect (double gregorian) |
Helper method for converting from non-vector formatted Gregorian date to vector format Gregorian date. More... | |
static double | Gregorian2JD (double gregorian) |
Gregorian calendar date -> Julian date. More... | |
static double | Gregorian2MJD (double gregorian) |
Gregorian calendar formatted date -> Julian date converter. More... | |
static double | GregorianVect2Gregorian (std::vector< double > gregorian) |
Helper method for converting from Gregorian vector format to the non-vector format. More... | |
static double | GregorianVect2JD (std::vector< double > gregorian) |
Gregorian calendar vector formatted date -> Julian date converter. More... | |
static double | GregorianVect2MJD (std::vector< double > gregorian) |
Gregorian calendar vector formatted date -> Modified Julian date converter. More... | |
static double | JD2Gregorian (const double jd) |
Julian date -> Gregorian calendar date conversion method. More... | |
static std::vector< double > | JD2GregorianVect (double jd) |
Julian date -> modified Julian date conversion method. More... | |
static double | JD2MJD (double jd) |
Julian date -> modified Julian date conversion method. More... | |
static double | MJD2Gregorian (double mjd) |
Modified Julian date -> Gregorian calendar date conversion method. More... | |
static std::vector< double > | MJD2GregorianVect (double mjd) |
Modified Julian date -> Gregorian calendar, vector formatted date. More... | |
static double | MJD2JD (double mjd) |
Modified Julian date -> Julian date conversion method. More... | |
static void | UTC2TDB (const double &mjd, double *tdb1, double *tdb2) |
Convert the UTC MJD to TDB JD (useful for planet computations) More... | |
static void | UTC2TT (const double &mjd, double *tt1, double *tt2) |
Convert the UTC MJD to TT JD. More... | |
static void | UTC2UT1 (const double &mjd, double *ut11, double *ut12) |
Convert the UTC MJD to UT1 JD. More... | |
static double | xpolar (const double &date, const CEDateType &date_type=CEDateType::JD) |
Polar motion (x) for a given date. More... | |
static double | ypolar (const double &date, const CEDateType &date_type=CEDateType::JD) |
Polar motion (xy for a given date. More... | |
Private Member Functions | |
void | copy_members (const CEDate &other) |
Copy data members from another date object. More... | |
void | free_members (void) |
Free data members. More... | |
void | init_members (void) |
Initialize the data members. More... | |
Private Attributes | |
double | gregorian_date_ |
Gregorian calendar date. Format as YYYYMMDD.DD. More... | |
std::vector< double > | gregorian_date_vect_ |
Vector containing the gregorian calendar date 0 - Year, 1 - Month, 2 - date, 3 - date fraction. More... | |
double | julian_date_ |
Julian date formated. More... | |
double | mod_julian_date_ |
Modified Julian date formated. More... | |
CEDateType | return_type_ = CEDateType::JD |
what format the 'operator double' will return More... | |
#include <CEDate.h>
CEDate::CEDate | ( | double | date = CurrentJD() , |
CEDateType | date_format = CEDateType::JD |
||
) |
Constructor from some date format.
Different formats are as follows:
Definition at line 45 of file CEDate.cpp.
|
explicit |
Constructor from a set of Gregorian values.
[in] | date | Gregorian date vector of the form
|
Definition at line 60 of file CEDate.cpp.
|
explicit |
Copy constructor.
Definition at line 70 of file CEDate.cpp.
|
virtual |
Destructor.
Definition at line 80 of file CEDate.cpp.
|
private |
Copy data members from another date object.
[in] | other | CEDate object to copy from |
Definition at line 686 of file CEDate.cpp.
|
static |
Static method for getting the current Julian date.
Definition at line 632 of file CEDate.cpp.
|
inline |
|
inline |
|
static |
Return dut1 based on a given modified date.
[in] | date | Date object |
[in] | date_type | Date format of date |
Definition at line 447 of file CEDate.cpp.
double CEDate::dut1 | ( | void | ) | const |
Return dut1 based on the date represented by this object.
Definition at line 462 of file CEDate.cpp.
|
private |
Free data members.
Definition at line 675 of file CEDate.cpp.
double CEDate::GetDate | ( | CEDateType | time_format = CEDateType::JD | ) | const |
Return the date in a given format.
[in] | time_format | Format of the output time object (see CEDateType) |
Definition at line 155 of file CEDate.cpp.
|
inlinestatic |
Gets the stored SOFA Julian date to Mod Julian date factor 'DJM0'.
mjd = jd - CEDate::GetMJD2JDFactor()
|
virtual |
Method for getting the number of seconds since midnight.
Set the 'utc_offset' in order to get local relative seconds since midnight.
utc_offset | Observer UTC offset (dont forget about daylight saving time) |
Definition at line 591 of file CEDate.cpp.
|
virtual |
Method for getting the current time.
Set the 'utc_offset' in order to get local time
utc_offset | Observer UTC offset (dont forget about daylight saving time) |
Definition at line 607 of file CEDate.cpp.
|
virtual |
Method for getting the current UTC time.
Definition at line 621 of file CEDate.cpp.
|
inlinevirtual |
Get the Gregorian calendar date formatted as a double.
Reimplemented in CERunningDate.
|
static |
Helper method for converting from non-vector formatted Gregorian date to vector format Gregorian date.
[in] | gregorian |
Definition at line 564 of file CEDate.cpp.
|
static |
Gregorian calendar date -> Julian date.
[in] | gregorian | Gregorian calendar date formatted as YYYYMMDD.D |
Definition at line 287 of file CEDate.cpp.
|
static |
Gregorian calendar formatted date -> Julian date converter.
[in] | gregorian | Gregorian calendar date formatted as YYYYMMDD.D |
Definition at line 343 of file CEDate.cpp.
|
inlinevirtual |
|
static |
Helper method for converting from Gregorian vector format to the non-vector format.
[in] | gregorian |
Definition at line 545 of file CEDate.cpp.
|
static |
Gregorian calendar vector formatted date -> Julian date converter.
Calls the SOFA "iauCal2jd" function
[in] | gregorian | Gregorian calendar date as a 4-element vector
|
Definition at line 307 of file CEDate.cpp.
|
static |
Gregorian calendar vector formatted date -> Modified Julian date converter.
[in] | gregorian | Gregorian calendar date as a 4-element vector
|
Definition at line 362 of file CEDate.cpp.
|
private |
Initialize the data members.
Definition at line 699 of file CEDate.cpp.
|
inlinevirtual |
Get the Julian date represented by this object.
Reimplemented in CERunningDate.
|
static |
Julian date -> Gregorian calendar date conversion method.
[in] | jd | Julian date |
Definition at line 193 of file CEDate.cpp.
|
static |
Julian date -> modified Julian date conversion method.
This function makes use of the SOFA 'iauJd2cal' method.
[in] | jd | Julian date |
Definition at line 211 of file CEDate.cpp.
|
static |
Julian date -> modified Julian date conversion method.
[in] | jd | Julian date |
Definition at line 182 of file CEDate.cpp.
|
inlinevirtual |
Get the Modified Julian date represented by this object.
Reimplemented in CERunningDate.
|
static |
Modified Julian date -> Gregorian calendar date conversion method.
[in] | mjd | Modified Julian date |
Definition at line 253 of file CEDate.cpp.
|
static |
Modified Julian date -> Gregorian calendar, vector formatted date.
[in] | mjd | Modified Julian date |
Definition at line 272 of file CEDate.cpp.
|
static |
Modified Julian date -> Julian date conversion method.
[in] | mjd | Modified Julian date |
Definition at line 241 of file CEDate.cpp.
|
inline |
CEDate::operator double | ( | ) |
Overload of the CEDate object which allows the object to be treated as a 'double' representing the date formatted according to 'return_type_'.
Definition at line 655 of file CEDate.cpp.
CEDate::operator double | ( | ) | const |
Overload of the CEDate object which allows the object to be treated as a 'double' representing the date formatted according to 'return_type_'.
Definition at line 665 of file CEDate.cpp.
Copy assignent operator.
[in] | other | CEDate object to be copied |
Definition at line 90 of file CEDate.cpp.
|
virtual |
Set the date based on an actual date and the desired time_format.
[in] | date | Date |
[in] | time_format | Time format (see CEDateType) |
Definition at line 107 of file CEDate.cpp.
|
virtual |
Set the date based on an actual date and the desired time_format.
[in] | date | Gregorian Date
|
Definition at line 145 of file CEDate.cpp.
|
inline |
Set the return type from the overloaded 'operator double'.
return_type | CEDateType for the returned double |
|
static |
Convert the UTC MJD to TDB JD (useful for planet computations)
[in] | mjd | Input modified Julian date for computation |
[out] | tdb1 | First part of returned TDB in JD |
[out] | tdb2 | Second part of returned TDB in JD |
Notes: 1) The full TDB in Julian date format can be obtained by summing tdb1 and tdb2. 2) tdb2
represents the TDB in modified Julian date 3) tdb1
should be the conversion factor between JD and MJD
Definition at line 429 of file CEDate.cpp.
|
static |
Convert the UTC MJD to TT JD.
[in] | mjd | Input modified Julian date for computation |
[out] | tt1 | First part of returned TT in JD |
[out] | tt2 | Second part of returned TT in JD |
Notes: 1) The full TT in Julian date format can be obtained by summing tt1 and tt2. 2) tt2
represents the TT in modified Julian date 3) tt1
should be the conversion factor between JD and MJD
Definition at line 405 of file CEDate.cpp.
|
static |
Convert the UTC MJD to UT1 JD.
[in] | mjd | Input modified Julian date for computation |
[out] | ut11 | First part of returned UT1 in JD |
[out] | ut12 | Second part of returned UT1 in JD |
Notes: 1) The full ut1 in Julian date format can be obtained by summing ut11 and ut12. 2) ut12
represents the UT1 in modified Julian date 3) ut11
should be the conversion factor between JD and MJD
Definition at line 384 of file CEDate.cpp.
|
static |
Polar motion (x) for a given date.
[in] | date | Date object |
[in] | date_type | Date format of date |
Definition at line 494 of file CEDate.cpp.
double CEDate::xpolar | ( | void | ) | const |
Polar motion (x) for a given date.
Definition at line 507 of file CEDate.cpp.
|
inline |
|
static |
Polar motion (xy for a given date.
[in] | date | Date object |
[in] | date_type | Date format of date |
Definition at line 520 of file CEDate.cpp.
double CEDate::ypolar | ( | void | ) | const |
Polar motion (y) for a given date.
Definition at line 533 of file CEDate.cpp.
|
private |
|
private |
|
private |
|
private |