SuperNOVAS C++ API v1.6
High-precision C/C++ astrometry library
Loading...
Searching...
No Matches
supernovas::Time Class Reference

Precise astronomical time specification, supporting all relevant astronomical timescales (UT1, UTC, TAI, GPS, TT, TDB, TCG, and TCB). More...

#include <supernovas.h>

Inheritance diagram for supernovas::Time:

Public Member Functions

 Time (const novas_timespec *t)
 Instantiates an astrometric time instance with the specified SuperNOVAS C astrometric time specification data structure.
 Time (const std::string &timestamp, const EOP &eop, enum novas_timescale timescale=NOVAS_UTC)
 Instantiates an astrometric time instance with the specified time parameters.
 Time (const std::string &timestamp, int leap_seconds, double dUT1, enum novas_timescale timescale=NOVAS_UTC)
 Instantiates an astrometric time instance with the specified time parameters.
 Time (const struct timespec *t, const EOP &eop)
 Instantiates an astrometric time instance with the specified time parameters.
 Time (const struct timespec *t, int leap_seconds, double dUT1)
 Instantiates an astrometric time instance with the specified time parameters.
 Time (double jd, const EOP &eop, enum novas_timescale timescale=NOVAS_TT)
 Instantiates an astrometric time instance with the specified time parameters.
 Time (double jd, int leap_seconds, double dUT1, enum novas_timescale timescale=NOVAS_TT)
 Instantiates an astrometric time instance with the specified time parameters.
 Time (long ijd, double fjd, const EOP &eop, enum novas_timescale timescale=NOVAS_TT)
 Instantiates an astrometric time instance with the specified time parameters.
 Time (long ijd, double fjd, int leap_seconds, double dUT1, enum novas_timescale timescale=NOVAS_TT)
 Instantiates an astrometric time instance with the specified time parameters.
const novas_timespec_novas_timespec () const
 Returns the underlying C astrometric time specification data structure.
int day_of_week (enum novas_timescale timescale=NOVAS_UTC) const
 Returns the day of week index (1..7) for this time instance.
Interval dUT1 () const
 Returns the UT1 - UTC time difference for this time instance, as was provided during instantiation.
double epoch () const
 Returns the Julian coordinate epoch year of this time instance.
bool equals (const Time &time, const Interval &precision) const
 Checks if this time instance is the same as another time within the specified precision.
bool equals (const Time &time, double seconds=Unit::us) const
 Checks if this time instance is the same as another time within the specified precision.
TimeAngle era () const
 Returns the Earth Rotation Angle (ERA), which measures the angle between the Terrestrial Intermediate Origin (TIO) and the Celestial Intermediate Origin (CIO) in the IAU 2000 convention.
TimeAngle gmst () const
 Returns the Greenwich Mean Sidereal Time (GMST) for this time instance.
TimeAngle gst (enum novas_accuracy accuracy=NOVAS_FULL_ACCURACY) const
 Returns the Greenwich (Apparent) Sidereal Time (GST / GaST) for this time instance.
double jd (enum novas_timescale timescale=NOVAS_TT) const
 Returns the precise Julian Date of this time instance, in the specific timescale of choice.
long jd_day (enum novas_timescale timescale=NOVAS_TT) const
 Returns the integer Julian day of this time instance, in the specific timescale of choice.
double jd_frac (enum novas_timescale timescale=NOVAS_TT) const
 Returns the factional Julian Day (MJD) of this time instance, in the specific timescale of choice.
int leap_seconds () const
 Returns the leap seconds for this time instance, as was provided during instantiation.
TimeAngle lst (const Site &site, enum novas_accuracy accuracy=NOVAS_FULL_ACCURACY) const
 Returns the Local (Apparent) Sidereal Time for this time instance.
double mjd (enum novas_timescale timescale=NOVAS_TT) const
 Returns the precise Modified Julian Date (MJD) this time instance, in the specific timescale of choice.
long mjd_day (enum novas_timescale timescale=NOVAS_TT) const
 Returns the integer Modified Julian Day (MJD) of this time instance, in the specific timescale of choice.
double mjd_frac (enum novas_timescale timescale=NOVAS_TT) const
 Returns the integer Modified Julian Day (MJD) of this time instance, in the specific timescale of choice.
Angle moon_phase () const
 Returns the phase of the Moon at this time instance.
Time next_moon_phase (const Angle &phase) const
 Returns the next time, after this time instance, when the Moon will be in the specified phase.
Interval offset_from (const Time &time, enum novas_timescale timescale=NOVAS_TT) const
 Returns the difference of this time from the specified other time, in the specified timescale.
bool operator!= (const Time &time) const
 Checks if this time instance differs from another time by more than 1 μs.
Time operator+ (const Interval &delta) const
 Returns an offset time in the backward direction.
Time operator+ (double seconds) const
 Returns an offset time.
Interval operator- (const CalendarDate &other) const
Time operator- (const Interval &delta) const
 Returns an offset time.
Interval operator- (const Time &other) const
 Returns the difference of this time from the specified other time, in regular Earth-based time measures (GPS, TAI, TT – and also UTC assuming no change in leap seconds).
Time operator- (double seconds) const
 Returns an offset time in the backwards direction.
bool operator< (const Time &other) const
 Checks if this time is prior to the specified other time, at the full precision of the representation.
bool operator<= (const Time &other) const
 Checks if this time is the same as or before the specified other time, at 1 μs resolution.
bool operator== (const Time &time) const
 Checks if this time instance is the same as another time within 1 μs.
bool operator> (const Time &other) const
 Checks if this time is after to the specified other time, at the full precision of the representation.
bool operator>= (const Time &other) const
 Checks if this time is the same as or after the specified other time, at 1 μs resolution.
Time shifted (const Interval &offset, enum novas_timescale timescale=NOVAS_TT) const
 Returns an offset time.
Time shifted (double seconds, enum novas_timescale timescale=NOVAS_TT) const
 Returns an offset time.
TimeAngle time_of_day (enum novas_timescale timescale=NOVAS_TT) const
 Returns the time of (calendar) day of this time instance in the timescale of choice.
CalendarDate to_calendar_date (const Calendar &calendar=Calendar::astronomical(), enum novas_timescale timescale=NOVAS_UTC) const
 Returns a calendar date, in the calendar of choice, and in the timescale of choice, for time instance.
CalendarDate to_calendar_date (enum novas_timescale timescale) const
 Returns the astronomical calendar date instance for this astrometric time.
std::string to_epoch_string (int decimals=2) const
 Returns the string representation of the Julian coordinate epoch corresponding to this timestamp.
std::string to_iso_string () const
 Returns an ISO 8601 timestamp for this time instance.
std::string to_string (enum novas_timescale timescale=NOVAS_UTC) const
 Returns a string representation (a timestamp) of this time instance.
time_t unix_time (long *nanos=NULL) const
 Returns the precise UNIX time (UTC) corresponding to this time instance.
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 const Time & b1900 ()
 Returns the astrometric time for the B1900 epoch.
static const Time & b1950 ()
 Returns the astrometric time for the B1950 epoch.
static Time from_mjd (double mjd, const EOP &eop, enum novas_timescale timescale=NOVAS_TT)
 Returns a new astrometric time instance for a given Modified Julian Date (MJD), specified in the timescale of choice.
static Time from_mjd (double mjd, int leap_seconds, double dUT1, enum novas_timescale timescale=NOVAS_TT)
 Returns a new astrometric time instance for a given Modified Julian Date (MJD), specified in the timescale of choice.
static const Time & hip ()
 Returns the astrometric time for the Hipparcos catalog epoch (which is J1991.25).
static const Time & j2000 ()
 Returns the astrometric time for the J2000 epoch.
static Time now (const EOP &eop)
 Resturns a new astrometric time instance for the current time.
static const Time & undefined ()
 Returns a reference to a statically defined standard invalid astrometric time.

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.

Detailed Description

Precise astronomical time specification, supporting all relevant astronomical timescales (UT1, UTC, TAI, GPS, TT, TDB, TCG, and TCB).

See also
Interval, TimeAngle, Observer

Constructor & Destructor Documentation

◆ Time() [1/9]

supernovas::Time::Time ( double jd,
int leap_seconds,
double dUT1,
enum novas_timescale timescale = NOVAS_TT )

Instantiates an astrometric time instance with the specified time parameters.

Parameters
jd[day] Julian date (in the selected timescale)
leap_seconds[s] leap seconds, that is TAI - UTC (default: 0)
dUT1[s] UT1 - UTC time difference, e.g. from the IERS Bulletins or service (default: 0.0).
timescale(optional) Astronomical timescale (default: TT).
See also
now(), from_mjd(), j2000(), b1950(), b1900(), hip()

References supernovas::Validating::_valid, dUT1(), jd(), leap_seconds(), and novas_set_time().

◆ Time() [2/9]

supernovas::Time::Time ( double jd,
const EOP & eop,
enum novas_timescale timescale = NOVAS_TT )

Instantiates an astrometric time instance with the specified time parameters.

Parameters
jd[day] Julian date (in the selected timescale)
eopEarth Orientation Parameters (EOP) values, e.g. obtained from IERS.
timescale(optional) Astronomical timescale (default: TT).
See also
now(), from_mjd(), j2000(), b1950(), b1900(), hip()

References dUT1(), jd(), and leap_seconds().

◆ Time() [3/9]

supernovas::Time::Time ( long ijd,
double fjd,
int leap_seconds,
double dUT1,
enum novas_timescale timescale = NOVAS_TT )

Instantiates an astrometric time instance with the specified time parameters.

Parameters
ijd[day] integer part of Julian date (in the selected timescale)
fjd[day] fractional part of Julian date (in the selected timescale)
leap_seconds[s] leap seconds, that is TAI - UTC (default: 0)
dUT1[s] UT1 - UTC time difference, e.g. from the IERS Bulletins or service (default: 0.0).
timescale(optional) Astronomical timescale (default: TT).
See also
now(), from_mjd(), j2000(), b1950(), b1900(), hip()

References supernovas::Validating::_valid, dUT1(), leap_seconds(), and novas_set_split_time().

◆ Time() [4/9]

supernovas::Time::Time ( long ijd,
double fjd,
const EOP & eop,
enum novas_timescale timescale = NOVAS_TT )

Instantiates an astrometric time instance with the specified time parameters.

Parameters
ijd[day] integer part of Julian date (in the selected timescale)
fjd[day] fractional part of Julian date (in the selected timescale)
eopEarth Orientation Parameters (EOP) values, e.g. obtained from IERS.
timescale(optional) Astronomical timescale (default: TT).
See also
now(), from_mjd(), j2000(), b1950(), b1900(), hip()

References dUT1(), and leap_seconds().

◆ Time() [5/9]

supernovas::Time::Time ( const std::string & timestamp,
int leap_seconds,
double dUT1,
enum novas_timescale timescale = NOVAS_UTC )

Instantiates an astrometric time instance with the specified time parameters.

Parameters
timestampA precision timestamp, such as an ISO 8601 timestamp.
leap_seconds[s] leap seconds, that is TAI - UTC (default: 0)
dUT1[s] UT1 - UTC time difference, e.g. from the IERS Bulletins or service (default: 0.0).
timescale(optional) Astronomical timescale (default: TT).
See also
now(), from_mjd(), j2000(), b1950(), b1900(), hip()
novas_parse_date(), novas_parse_ido_date(), novas_parse_date_format(), novas_parse_timescale() for more managed parsing from strings.

References supernovas::Validating::_valid, dUT1(), leap_seconds(), and novas_set_str_time().

◆ Time() [6/9]

supernovas::Time::Time ( const std::string & timestamp,
const EOP & eop,
enum novas_timescale timescale = NOVAS_UTC )

Instantiates an astrometric time instance with the specified time parameters.

Parameters
timestampA precision timestamp, such as an ISO 8601 timestamp.
eopEarth Orientation Parameters (EOP) values, e.g. obtained from IERS.
timescale(optional) Astronomical timescale (default: TT).
See also
now(), from_mjd(), j2000(), b1950(), b1900(), hip()
novas_parse_date(), novas_parse_ido_date(), novas_parse_date_format(), novas_parse_timescale() for more managed parsing from strings.

References dUT1(), and leap_seconds().

◆ Time() [7/9]

supernovas::Time::Time ( const struct timespec * t,
int leap_seconds,
double dUT1 )

Instantiates an astrometric time instance with the specified time parameters.

Parameters
tA precision POSIX standard UTC timestamp.
leap_seconds[s] leap seconds, that is TAI - UTC (default: 0)
dUT1[s] UT1 - UTC time difference, e.g. from the IERS Bulletins or service (default: 0.0).
See also
now(), from_mjd(), j2000(), b1950(), b1900(), hip()

References supernovas::Validating::_valid, dUT1(), leap_seconds(), novas_set_unix_time(), and NOVAS_UTC.

◆ Time() [8/9]

supernovas::Time::Time ( const struct timespec * t,
const EOP & eop )

Instantiates an astrometric time instance with the specified time parameters.

Parameters
tA precision POSIX standard UTC timestamp.
eopEarth Orientation Parameters (EOP) values, e.g. obtained from IERS.
See also
now(), from_mjd(), j2000(), b1950(), b1900(), hip()

References dUT1(), and leap_seconds().

◆ Time() [9/9]

supernovas::Time::Time ( const novas_timespec * t)
explicit

Instantiates an astrometric time instance with the specified SuperNOVAS C astrometric time specification data structure.

Parameters
tpointer to the SuperNOVAS C astrometric time specification data structure.
See also
now(), from_mjd(), j2000(), b1950(), b1900(), hip()

References supernovas::Validating::_valid, novas_timespec::fjd_tt, novas_timespec::tt2tdb, and novas_timespec::ut1_to_tt.

Member Function Documentation

◆ _novas_timespec()

const novas_timespec * supernovas::Time::_novas_timespec ( ) const

Returns the underlying C astrometric time specification data structure.

Returns
a pointer to the underlying C time specification data structure.

◆ b1900()

const Time & supernovas::Time::b1900 ( )
static

Returns the astrometric time for the B1900 epoch.

Returns
the astrometric time for B1900.
See also
b1950(), j2000(), hip()

References NOVAS_JD_B1900, and NOVAS_TT.

◆ b1950()

const Time & supernovas::Time::b1950 ( )
static

Returns the astrometric time for the B1950 epoch.

Returns
the astrometric time for B1950.
See also
b1900(), j2000(), hip()

References NOVAS_JD_B1950, and NOVAS_TT.

◆ day_of_week()

int supernovas::Time::day_of_week ( enum novas_timescale timescale = NOVAS_UTC) const

Returns the day of week index (1..7) for this time instance.

Parameters
timescale(optional) the timescale in which to return the result (default: UTC).
Returns
The day-of-week index [1:7] in the same timescale as the input date. 1:Monday ... 7:Sunday, or else 0 if the input Julian Date is NAN.

References jd(), and novas_day_of_week().

◆ dUT1()

Interval supernovas::Time::dUT1 ( ) const

Returns the UT1 - UTC time difference for this time instance, as was provided during instantiation.

Returns
[s] The UT1 - UTC time difference.
See also
leap_seconds()

References supernovas::Validating::is_valid().

Referenced by Time(), Time(), Time(), Time(), Time(), Time(), Time(), Time(), from_mjd(), next_moon_phase(), operator-(), and shifted().

◆ epoch()

double supernovas::Time::epoch ( ) const

Returns the Julian coordinate epoch year of this time instance.

Returns
[yr] the Julian coordinate epoch (e.g. 2000.0 for J2000).

References jd(), NOVAS_JD_J2000, and NOVAS_JULIAN_YEAR_DAYS.

Referenced by to_epoch_string().

◆ equals() [1/2]

bool supernovas::Time::equals ( const Time & time,
const Interval & precision ) const

Checks if this time instance is the same as another time within the specified precision.

Parameters
Time of observation and astronomical timescalesthe other time
precision(optional) The precision for the comparison (default: 1 μs).
Returns
true if the two times are equal within the specified precision, otherwise false.
See also
operator==(), operator!=()

References equals(), and supernovas::Interval::seconds().

◆ equals() [2/2]

bool supernovas::Time::equals ( const Time & time,
double precision = Unit::us ) const

Checks if this time instance is the same as another time within the specified precision.

Parameters
Time of observation and astronomical timescalesthe other time
precision[s] (optional) The precision for the comparison (default: 1 &mus)
Returns
true if the two times are equal within the specified precision, otherwise false.
See also
operator==(), operator!=()

References novas_diff_time().

Referenced by equals(), operator!=(), and operator==().

◆ era()

TimeAngle supernovas::Time::era ( ) const

Returns the Earth Rotation Angle (ERA), which measures the angle between the Terrestrial Intermediate Origin (TIO) and the Celestial Intermediate Origin (CIO) in the IAU 2000 convention.

Returns
The Earth Rotation Angle (ERA) as a time-angle.

References supernovas::Unit::deg, and supernovas::Validating::is_valid().

◆ from_mjd() [1/2]

Time supernovas::Time::from_mjd ( double mjd,
const EOP & eop,
enum novas_timescale timescale = NOVAS_TT )
static

Returns a new astrometric time instance for a given Modified Julian Date (MJD), specified in the timescale of choice.

Parameters
mjd[day] Modified Julian Date, in the timescale of choice
eopEarth Orientation Parameters (EOP) values, e.g. obtained from IERS.
timescale(optional) timescale in which MJD was specified (default: TT)
Returns
a new astrometric time instance for the given MJD date.
See also
Time(), now(), j2000(), b1950(), b1900(), hip()

References supernovas::EOP::dUT1(), from_mjd(), supernovas::EOP::leap_seconds(), mjd(), and supernovas::Interval::seconds().

◆ from_mjd() [2/2]

Time supernovas::Time::from_mjd ( double mjd,
int leap_seconds,
double dUT1,
enum novas_timescale timescale = NOVAS_TT )
static

Returns a new astrometric time instance for a given Modified Julian Date (MJD), specified in the timescale of choice.

Parameters
mjd[day] Modified Julian Date, in the timescale of choice
leap_seconds[s] leap seconds, that is TAI - UTC (default: 0)
dUT1[s] UT1 - UTC time difference, e.g. from the IERS Bulletins or service (default: 0.0).
timescale(optional) timescale in which MJD was specified (default: TT)
Returns
a new astrometric time instance for the given MJD date.
See also
Time(), now(), j2000(), b1950(), b1900(), hip()

References dUT1(), supernovas::Validating::is_valid(), leap_seconds(), mjd(), and NOVAS_JD_MJD0.

Referenced by from_mjd().

◆ gmst()

TimeAngle supernovas::Time::gmst ( ) const

Returns the Greenwich Mean Sidereal Time (GMST) for this time instance.

Returns
the GMST time-angle
See also
gst(), lst()

References supernovas::Unit::hour_angle, supernovas::Validating::is_valid(), novas_get_time(), novas_gmst(), and NOVAS_UT1.

◆ gst()

TimeAngle supernovas::Time::gst ( enum novas_accuracy accuracy = NOVAS_FULL_ACCURACY) const

Returns the Greenwich (Apparent) Sidereal Time (GST / GaST) for this time instance.

Parameters
accuracyNOVAS_FULL_ACCURACY (0) for μs-level precision or NOVAS_REDUCED_ACCURACY (1) for &ms-level precison.
Returns
the GST / GaST time-angle.
See also
gmst(), lst(), era()

References supernovas::Unit::hour_angle, supernovas::Validating::is_valid(), and novas_time_gst().

◆ hip()

const Time & supernovas::Time::hip ( )
static

Returns the astrometric time for the Hipparcos catalog epoch (which is J1991.25).

Returns
the astrometric time for the Hipparcos catalog epoch, that is J1991.25.
See also
j2000(), b1950, b1900()

References NOVAS_JD_HIP, and NOVAS_TT.

◆ j2000()

const Time & supernovas::Time::j2000 ( )
static

Returns the astrometric time for the J2000 epoch.

Returns
the astrometric time for J2000, that is 12:00:00 TT, 1 Jan 2000.
See also
b1950, b1900(), hip()

References NOVAS_JD_J2000, and NOVAS_TT.

Referenced by supernovas::Ecliptic::to_mod().

◆ jd()

◆ jd_day()

long supernovas::Time::jd_day ( enum novas_timescale timescale = NOVAS_TT) const

Returns the integer Julian day of this time instance, in the specific timescale of choice.

Parameters
timescale(optional) the timescale in which to return the result (default: TT).
Returns
[day] the integer Julian day in the requested timescale.
See also
jd_frac(), mjd_day(), mjd(), jd()

References novas_get_split_time(), and NOVAS_TIMESCALES.

◆ jd_frac()

double supernovas::Time::jd_frac ( enum novas_timescale timescale = NOVAS_TT) const

Returns the factional Julian Day (MJD) of this time instance, in the specific timescale of choice.

0h in Julian dates is at noon.

Parameters
timescale(optional) the timescale in which to return the result (default: TT).
Returns
[day] the fractional part of the Julian Day in the requested timescale.
See also
mjd_frac(), jd_day(), jd()

References novas_get_split_time(), and NOVAS_TIMESCALES.

Referenced by mjd_frac().

◆ leap_seconds()

int supernovas::Time::leap_seconds ( ) const

Returns the leap seconds for this time instance, as was provided during instantiation.

Returns
[s] the leap seconds (TAI - UTC).
See also
dUT1()

References novas_time_leap().

Referenced by Time(), Time(), Time(), Time(), Time(), Time(), Time(), Time(), from_mjd(), next_moon_phase(), operator-(), and shifted().

◆ lst()

TimeAngle supernovas::Time::lst ( const Site & site,
enum novas_accuracy accuracy = NOVAS_FULL_ACCURACY ) const

Returns the Local (Apparent) Sidereal Time for this time instance.

Parameters
siteobserving site
accuracy(optional) NOVAS_FULL_ACCURACY (0; default) for μs-level precision or NOVAS_REDUCED_ACCURACY (1) for &ms-level precison.
Returns
the LST / LaST time-angle.
See also
gst(), era()

References supernovas::Angle::deg(), supernovas::Unit::hour_angle, supernovas::Validating::is_valid(), supernovas::Site::longitude(), and novas_time_lst().

◆ mjd()

double supernovas::Time::mjd ( enum novas_timescale timescale = NOVAS_TT) const

Returns the precise Modified Julian Date (MJD) this time instance, in the specific timescale of choice.

Parameters
timescale(optional) the timescale in which to return the result (default: TT).
Returns
[day] the precise Modifie Julian Date (MJD) in the requested timescale.
See also
mjd_day(), jd()

References novas_get_split_time(), NOVAS_JD_MJD0, and NOVAS_TIMESCALES.

Referenced by from_mjd(), from_mjd(), and operator-().

◆ mjd_day()

long supernovas::Time::mjd_day ( enum novas_timescale timescale = NOVAS_TT) const

Returns the integer Modified Julian Day (MJD) of this time instance, in the specific timescale of choice.

Parameters
timescale(optional) the timescale in which to return the result (default: TT).
Returns
[day] the integer Modified Julian Day (MJD) in the requested timescale.
See also
jd_frac(), jd_day(), mjd(), jd()

References novas_get_split_time(), and NOVAS_TIMESCALES.

◆ mjd_frac()

double supernovas::Time::mjd_frac ( enum novas_timescale timescale = NOVAS_TT) const

Returns the integer Modified Julian Day (MJD) of this time instance, in the specific timescale of choice.

0h in MJD is at midnight.

Parameters
timescale(optional) the timescale in which to return the result (default: TT).
Returns
[day] the fractional part of the Julian Day in the requested timescale.
See also
jd_frac(), mjd_day(), mjd()

References jd_frac(), and NOVAS_TIMESCALES.

Referenced by time_of_day().

◆ moon_phase()

Angle supernovas::Time::moon_phase ( ) const

Returns the phase of the Moon at this time instance.

Returns
The Moon's phase, or more precisely the ecliptic longitude difference between the Sun and the Moon, as seen from the geocenter. 0°: New Moon, 90°: 1st quarter, +/- 180° Full Moon, -90°: 3rd quarter, or NAN if the solution failed to converge (errno will be set to ECANCELED).
See also
next_moon_phase()

References supernovas::Unit::deg, supernovas::Validating::is_valid(), jd(), novas_moon_phase(), and NOVAS_TDB.

◆ next_moon_phase()

Time supernovas::Time::next_moon_phase ( const Angle & phase) const

Returns the next time, after this time instance, when the Moon will be in the specified phase.

Parameters
phaseThe Moon's phase. 0°: New Moon, 90°: 1st quarter, +/- 180° Full Moon, -90°: 3rd quarter.
Returns
The next time the Moon will be in the specified phase.
See also
moon_phase()

References supernovas::Angle::deg(), dUT1(), supernovas::Validating::is_valid(), jd(), leap_seconds(), novas_next_moon_phase(), and NOVAS_TDB.

◆ now()

Time supernovas::Time::now ( const EOP & eop)
static

Resturns a new astrometric time instance for the current time.

It is only as accurate as the system clock, and its precision may be limited by the resolution of the system clock also. Be sure that your computer is well synchronized to a trustworthy time server, preferably on a local network, such as an ntp server with a GPS receiver.

Parameters
eopEarth Orientation Parameters (EOP) values, e.g. obtained from IERS.
Returns
a new astrometric time corresponding to the current system time.
See also
Time(), from_mjd(), j2000(), b1950(), b1900(), hip()

References supernovas::EOP::dUT1(), supernovas::Validating::is_valid(), supernovas::EOP::leap_seconds(), novas_set_current_time(), and supernovas::Interval::seconds().

◆ offset_from()

Interval supernovas::Time::offset_from ( const Time & time,
enum novas_timescale timescale = NOVAS_TT ) const

Returns the difference of this time from the specified other time, in the specified timescale.

All timescales are supported.

Parameters
Time of observation and astronomical timescalesthe other time
timescale(optional) the timescale in which to return the result (default: TT).
Returns
the difference between this time and the argument time in the specified timescale.

operator-(), shifted()

References supernovas::Validating::is_valid(), and novas_diff_time_scale().

Referenced by operator-().

◆ operator!=()

bool supernovas::Time::operator!= ( const Time & time) const

Checks if this time instance differs from another time by more than 1 μs.

Parameters
Time of observation and astronomical timescalesthe other time
Returns
true if the two times differ by more than 1 μs.
See also
operator==(), operator!=()

References equals().

◆ operator+() [1/2]

Time supernovas::Time::operator+ ( const Interval & offset) const

Returns an offset time in the backward direction.

It assumes that the leap seconds and UT1 - UTC time difference of this time instance is also valid for the offset time, which should be true typically for reasonably small time offsets.

Parameters
offsetthe offset interval (in backwards direction).
Returns
a new time that is offset from this one by the specified interval.
See also
oerator-(), shifted()

References supernovas::Interval::seconds().

◆ operator+() [2/2]

Time supernovas::Time::operator+ ( double seconds) const

Returns an offset time.

It assumes that the leap seconds and UT1 - UTC time difference of this time instance is also valid for the offset time, which should be true typically for reasonably small time offsets.

Parameters
seconds[s] the offset interval
Returns
a new time that is offset from this one by the specified interval in the reverse direction (backwards in time).
See also
oerator+(), shifted()

References shifted().

◆ operator-() [1/4]

◆ operator-() [2/4]

Time supernovas::Time::operator- ( const Interval & offset) const

Returns an offset time.

It assumes that the leap seconds and UT1 - UTC time difference of this time instance is also valid for the offset time, which should be true typically for reasonably small time offsets.

Parameters
offsetthe offset interval
Returns
a new time that is offset from this one by the specified interval in the reverse direction (backwards in time).
See also
operator+(), shifted()

References supernovas::Interval::seconds().

◆ operator-() [3/4]

Interval supernovas::Time::operator- ( const Time & r) const

Returns the difference of this time from the specified other time, in regular Earth-based time measures (GPS, TAI, TT – and also UTC assuming no change in leap seconds).

Parameters
rthe other time
Returns
the difference between this time and the argument in regular Earth-based timescales.

offset_from()

References supernovas::Validating::is_valid(), and offset_from().

◆ operator-() [4/4]

Time supernovas::Time::operator- ( double seconds) const

Returns an offset time in the backwards direction.

It assumes that the leap seconds and UT1 - UTC time difference of this time instance is also valid for the offset time, which should be true typically for reasonably small time offsets.

Parameters
seconds[s] the offset interval (backwards direction).
Returns
a new time that is offset from this one by the specified interval in the reverse direction (backwards in time).
See also
oerator+(), shifted()

References shifted().

◆ operator<()

bool supernovas::Time::operator< ( const Time & r) const

Checks if this time is prior to the specified other time, at the full precision of the representation.

Parameters
rthe other time
Returns
true if this time instance is before the specified other time, or else false.
See also
operator<=(), operator>(), operator>=()

References novas_diff_time().

◆ operator<=()

bool supernovas::Time::operator<= ( const Time & r) const

Checks if this time is the same as or before the specified other time, at 1 μs resolution.

Parameters
rthe other time
Returns
true if this time instance is the same as or before the specified other time, or else false.
See also
operator<(), operator>=(), operator>()

References novas_diff_time(), and supernovas::Unit::us.

◆ operator==()

bool supernovas::Time::operator== ( const Time & time) const

Checks if this time instance is the same as another time within 1 μs.

Parameters
Time of observation and astronomical timescalesthe other time
Returns
true if the two times are equal within 1 μs, otherwise false.
See also
equals(), operator!=()

References equals().

◆ operator>()

bool supernovas::Time::operator> ( const Time & r) const

Checks if this time is after to the specified other time, at the full precision of the representation.

Parameters
rthe other time
Returns
true if this time instance is after the specified other time, or else false.
See also
operator>=(), operator<(), operator<=()

◆ operator>=()

bool supernovas::Time::operator>= ( const Time & r) const

Checks if this time is the same as or after the specified other time, at 1 μs resolution.

Parameters
rthe other time
Returns
true if this time instance is the same as or after the specified other time, or else false.
See also
operator<(), operator>=(), operator>()

◆ shifted() [1/2]

Time supernovas::Time::shifted ( const Interval & offset,
enum novas_timescale timescale = NOVAS_TT ) const

Returns an offset time.

It assumes that the leap seconds and UT1 - UTC time difference of this time instance is also valid for the offset time, which should be true typically for reasonably small time offsets.

Parameters
offsetthe offset interval in a regular Earth-based timescale (GPS, TAI, TT – or UTC assuming no change in leap seconds).
timescale(optional) timescale in which offset time is given (default: TT / TAI / GPS).
Returns
a new time that is offset from this one by the specified interval in the specified timescale
See also
oerator+(), offset_from()

References supernovas::Interval::seconds(), and shifted().

◆ shifted() [2/2]

Time supernovas::Time::shifted ( double seconds,
enum novas_timescale timescale = NOVAS_TT ) const

Returns an offset time.

It assumes that the leap seconds and UT1 - UTC time difference of this time instance is also valid for the offset time, which should be true typically for reasonably small time offsets.

Parameters
seconds[s] the offset interval in a regular Earth-based timescale (GPS, TAI, TT – or UTC assuming no change in leap seconds).
timescale(optional) timescale in which offset time is given (default: TT / TAI / GPS).
Returns
a new time that is offset from this one by the specified interval in the specified timescale.
See also
oerator+(), offset_from()

References supernovas::Unit::day, dUT1(), supernovas::Validating::is_valid(), leap_seconds(), novas_get_split_time(), novas_set_split_time(), and undefined().

Referenced by operator+(), operator-(), and shifted().

◆ time_of_day()

TimeAngle supernovas::Time::time_of_day ( enum novas_timescale timescale = NOVAS_TT) const

Returns the time of (calendar) day of this time instance in the timescale of choice.

Parameters
timescale(optional) the timescale in which to return the result (default: TT).
Returns
The time of day in the requested timescale.
See also
jd_time_of_day()

References supernovas::Validating::is_valid(), mjd_frac(), and TWOPI.

◆ to_calendar_date() [1/2]

CalendarDate supernovas::Time::to_calendar_date ( const Calendar & calendar = Calendar::astronomical(),
enum novas_timescale timescale = NOVAS_UTC ) const

Returns a calendar date, in the calendar of choice, and in the timescale of choice, for time instance.

Parameters
calendar(optional) Calendar in which to represent this time instance (default: astronomical)
timescale(optional) timescale in which MJD was specified (default: TT)
Returns
the calendar date in the desired calendar and timescale of choice.

References supernovas::Calendar::date(), supernovas::Validating::is_valid(), and jd().

Referenced by to_calendar_date().

◆ to_calendar_date() [2/2]

CalendarDate supernovas::Time::to_calendar_date ( enum novas_timescale timescale) const

Returns the astronomical calendar date instance for this astrometric time.

The astronomical calendar is the conventional calendar of date, which is the Gregorian calendar after the Gregorian calendar reform if 1582, and the Roman calendar prior to that.

Parameters
timescaletimescale in which MJD was specified (default: TT)
Returns
the astronomical calendar date in the timescale of choice.

References supernovas::Calendar::astronomical(), and to_calendar_date().

◆ to_epoch_string()

std::string supernovas::Time::to_epoch_string ( int decimals = 2) const

Returns the string representation of the Julian coordinate epoch corresponding to this timestamp.

Parameters
decimals(optional) number of decimal places to show on the year (default: 2).
Returns
a new string representing the Julian coordinate epoch of this time with the requested precision, or "<invalid epoch>"

References epoch(), and supernovas::Validating::is_valid().

◆ to_iso_string()

std::string supernovas::Time::to_iso_string ( ) const

Returns an ISO 8601 timestamp for this time instance.

Returns
a new string containing the ISO 8601 timestamp, or "<invalid time>".
See also
to_string()

References supernovas::Validating::is_valid(), and novas_iso_timestamp().

◆ to_string()

std::string supernovas::Time::to_string ( enum novas_timescale timescale = NOVAS_UTC) const

Returns a string representation (a timestamp) of this time instance.

Parameters
timescale(optional) the timescale in which to represent time (default: UTC).
Returns
a new string containing the timestamp, or "<invalid time>".
See also
to_iso_timestamp(), to_epoch_string()

References supernovas::Validating::is_valid(), and novas_timestamp().

◆ undefined()

const Time & supernovas::Time::undefined ( )
static

Returns a reference to a statically defined standard invalid astrometric time.

This invalid time may be used inside any object that is invalid itself.

Returns
a reference to a static standard invalid astrometric time.

Referenced by shifted().

◆ unix_time()

time_t supernovas::Time::unix_time ( long * nanos = NULL) const

Returns the precise UNIX time (UTC) corresponding to this time instance.

Parameters
[out]nanos[ns] (optional) pointer to value in which to return the sub-second component, or NULL if not required.
Returns
[s] the integer UNIX seconds (UTC) of this time instance.

References novas_get_unix_time().