![]() |
SuperNOVAS C++ API v1.6
High-precision C/C++ astrometry library
|
A signed time interval between two instants of time, in the astronomical timescale of choice. More...
#include <supernovas.h>
Public Member Functions | |
| Interval (double seconds, enum novas_timescale timescale=NOVAS_TT) | |
| Instantiates a new time interval with the specified time in seconds and a timescale (TT by default). | |
| double | days () const |
| Returns this time interval in days. | |
| bool | equals (const Interval &interval, double precision=Unit::us) const |
| Checks if this time interval is equal to the specified other time interval within the specified precision. | |
| double | hours () const |
| Returns this time interval in hours. | |
| Interval | inv () const |
| Returns the inverse of this time interval ie, its negated value. | |
| double | julian_centuries () const |
| Returns this time interval in Julian centuries. | |
| double | julian_years () const |
| Returns this time interval in Julian years. | |
| double | milliseconds () const |
| Returns this time interval in milliseconds. | |
| double | minutes () const |
| Returns this time interval in minutes. | |
| bool | operator!= (const Interval &interval) const |
| Checks if this time interval differs from the specified other time interval at the full double-precision. | |
| Coordinate | operator* (const ScalarVelocity &v) const |
| Returns the distance travelled in this time interval at the specified speed. | |
| Position | operator* (const Velocity &v) const |
| Returns the spatial vector travelled in this time interval at the specified velocity. | |
| Interval | operator+ (const Interval &r) const |
| Returns a new time interval that is the sum of this time interval and the specified other time interval. | |
| Interval | operator- (const Interval &r) const |
| Returns a new time interval that is the signed difference of this time interval and the specified other time interval. | |
| bool | operator== (const Interval &interval) const |
| Checks if this time interval is equal to the specified other time interval at the full double-precision. | |
| double | seconds () const |
| Returns this time interval in seconds. | |
| enum novas_timescale | timescale () const |
| Returns the time scale in which this time interval was defined. | |
| std::string | to_string (int decimals=3) const |
| Returns a string representation of this interval using the specified number of significant figures and a best matched time unit. | |
| Interval | to_timescale (enum novas_timescale scale) const |
| Returns a new time interval, which matches this time interval in the specified other timescale. | |
| double | weeks () const |
| Returns this time interval in weeks. | |
| double | years () const |
| Returns this time interval in calendar years. | |
| 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 Interval & | zero () |
| Returns a reference to the zero time interval. | |
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. | |
A signed time interval between two instants of time, in the astronomical timescale of choice.
|
explicit |
Instantiates a new time interval with the specified time in seconds and a timescale (TT by default).
| seconds | [s] time span in seconds. |
| timescale | (optional) timescale in which the interval was defined (default: novas:NOVAS_TT) |
References supernovas::Validating::_valid, NOVAS_TIMESCALES, seconds(), and timescale().
Referenced by equals(), inv(), operator!=(), operator+(), operator-(), operator==(), to_timescale(), and zero().
| double supernovas::Interval::days | ( | ) | const |
Returns this time interval in days.
References supernovas::Unit::day.
Referenced by supernovas::CalendarDate::operator+(), supernovas::CalendarDate::operator-(), and to_string().
Checks if this time interval is equal to the specified other time interval within the specified precision.
The comparison is performed in Terrestrial Time (TT).
| interval | the reference time interval. |
| precision | [s] the precision used for checking equality. |
References Interval().
Referenced by operator!=(), and operator==().
| double supernovas::Interval::hours | ( | ) | const |
Returns this time interval in hours.
References supernovas::Unit::hour.
Referenced by supernovas::TimeAngle::operator+(), supernovas::TimeAngle::operator-(), and to_string().
| Interval supernovas::Interval::inv | ( | ) | const |
Returns the inverse of this time interval ie, its negated value.
References Interval().
| double supernovas::Interval::julian_centuries | ( | ) | const |
Returns this time interval in Julian centuries.
References supernovas::Unit::julian_century.
| double supernovas::Interval::julian_years | ( | ) | const |
Returns this time interval in Julian years.
References supernovas::Unit::julian_year.
| double supernovas::Interval::milliseconds | ( | ) | const |
Returns this time interval in milliseconds.
References supernovas::Unit::ms.
Referenced by to_string().
| double supernovas::Interval::minutes | ( | ) | const |
Returns this time interval in minutes.
References supernovas::Unit::min.
| bool supernovas::Interval::operator!= | ( | const Interval & | interval | ) | const |
Checks if this time interval differs from the specified other time interval at the full double-precision.
The comparison is performed in Terrestrial Time (TT).
| interval | the reference time interval. |
References Interval(), and equals().
| Coordinate supernovas::Interval::operator* | ( | const ScalarVelocity & | v | ) | const |
Returns the distance travelled in this time interval at the specified speed.
| v | speed value |
References supernovas::Validating::is_valid(), and supernovas::ScalarVelocity::travel().
Returns the spatial vector travelled in this time interval at the specified velocity.
| v | speed value |
References supernovas::Validating::is_valid(), and supernovas::Velocity::travel().
Returns a new time interval that is the sum of this time interval and the specified other time interval.
| r | the other time interval |
References Interval().
Returns a new time interval that is the signed difference of this time interval and the specified other time interval.
| r | the other time interval |
References Interval().
| bool supernovas::Interval::operator== | ( | const Interval & | interval | ) | const |
Checks if this time interval is equal to the specified other time interval at the full double-precision.
The comparison is performed in Terrestrial Time (TT).
| interval | the reference time interval. |
References Interval(), and equals().
| double supernovas::Interval::seconds | ( | ) | const |
Returns this time interval in seconds.
Referenced by Interval(), supernovas::CalendarDate::equals(), supernovas::Equinox::equals(), supernovas::Time::equals(), supernovas::Source::equatorial_track(), supernovas::Time::from_mjd(), supernovas::Time::now(), supernovas::Time::operator+(), supernovas::Time::operator-(), supernovas::Coordinate::operator/(), supernovas::Position::operator/(), supernovas::OrbitalSystem::orbit(), supernovas::ScalarEvolution::rate(), supernovas::Time::shifted(), supernovas::CalendarDate::to_time(), supernovas::ScalarVelocity::travel(), supernovas::Velocity::travel(), and supernovas::ScalarEvolution::value().
| enum novas_timescale supernovas::Interval::timescale | ( | ) | const |
Returns the time scale in which this time interval was defined.
Referenced by Interval().
| std::string supernovas::Interval::to_string | ( | int | decimals = 3 | ) | const |
Returns a string representation of this interval using the specified number of significant figures and a best matched time unit.
References supernovas::Unit::day, days(), supernovas::Unit::hour, hours(), milliseconds(), supernovas::Unit::s, years(), and supernovas::Unit::yr.
Referenced by supernovas::Orbital::to_string().
| Interval supernovas::Interval::to_timescale | ( | enum novas_timescale | scale | ) | const |
Returns a new time interval, which matches this time interval in the specified other timescale.
| scale | the timescale of the returned equivalent interval. |
References Interval().
| double supernovas::Interval::weeks | ( | ) | const |
Returns this time interval in weeks.
References supernovas::Unit::week.
| double supernovas::Interval::years | ( | ) | const |
Returns this time interval in calendar years.
References supernovas::Unit::yr.
Referenced by to_string().
|
static |
Returns a reference to the zero time interval.
References Interval().