Class AbsoluteDate
- All Implemented Interfaces:
Serializable,Comparable<TimeOffset>,TimeShiftable<AbsoluteDate>,TimeStamped
Instances of this class are considered to be absolute in the sense
that each one represent the occurrence of some event and can be compared
to other instances or located in any time scale. In
other words the different locations of an event with respect to two different
time scales (say TAI and UTC for example) are
simply different perspective related to a single object. Only one
AbsoluteDate instance is needed, both representations being available
from this single instance by specifying the time scales as parameter when calling
the ad-hoc methods.
Since an instance is not bound to a specific time-scale, all methods related to the location of the date within some time scale require to provide the time scale as an argument. It is therefore possible to define a date in one time scale and to use it in another one. An example of such use is to read a date from a file in UTC and write it in another file in TAI. This can be done as follows:
DateTimeComponents utcComponents = readNextDate(); AbsoluteDate date = new AbsoluteDate(utcComponents, TimeScalesFactory.getUTC()); writeNextDate(date.getComponents(TimeScalesFactory.getTAI()));
Two complementary views are available:
location view (mainly for input/output or conversions)
locations represent the coordinate of one event with respect to a
time scale. The related methods areAbsoluteDate(DateComponents, TimeComponents, TimeScale),AbsoluteDate(int, int, int, int, int, double, TimeScale),AbsoluteDate(int, int, int, TimeScale),AbsoluteDate(Date, TimeScale),parseCCSDSCalendarSegmentedTimeCode(byte, byte[]),toDate(TimeScale),toString(timeScale),toString(), andtimeScalesOffset(org.orekit.time.TimeScale, org.orekit.time.TimeScale).offset view (mainly for physical computation)
offsets represent either the flow of time between two events (two instances of the class) or durations. They are counted in seconds, are continuous and could be measured using only a virtually perfect stopwatch. The related methods are
AbsoluteDate(AbsoluteDate, double),parseCCSDSUnsegmentedTimeCode(byte, byte, byte[], AbsoluteDate),parseCCSDSDaySegmentedTimeCode(byte, byte[], DateComponents),durationFrom(AbsoluteDate),TimeOffset.compareTo(TimeOffset),TimeOffset.equals(Object)andTimeOffset.hashCode().
A few reference epochs which are commonly used in space systems have been defined. These
epochs can be used as the basis for offset computation. The supported epochs are:
JULIAN_EPOCH, MODIFIED_JULIAN_EPOCH, FIFTIES_EPOCH,
CCSDS_EPOCH, GALILEO_EPOCH, GPS_EPOCH, QZSS_EPOCH
J2000_EPOCH, JAVA_EPOCH.
There are also two factory methods createJulianEpoch(double)
and createBesselianEpoch(double) that can be used to compute other reference
epochs like J1900.0 or B1950.0.
In addition to these reference epochs, two other constants are defined for convenience:
PAST_INFINITY and FUTURE_INFINITY, which can be used either as dummy
dates when a date is not yet initialized, or for initialization of loops searching for
a min or max date.
Instances of the AbsoluteDate class are guaranteed to be immutable.
- Author:
- Luc Maisonobe, Evan Ward
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AbsoluteDateAn arbitrary finite date.static final AbsoluteDateReference epoch for BeiDou weeks: 2006-01-01T00:00:00 UTC.static final AbsoluteDateReference epoch for CCSDS Time Code Format (CCSDS 301.0-B-4): 1958-01-01T00:00:00 International Atomic Time (not UTC).static final AbsoluteDateReference epoch for 1950 dates: 1950-01-01T00:00:00 Terrestrial Time.static final AbsoluteDateDummy date at infinity in the future direction.static final AbsoluteDateReference epoch for Galileo System Time: 1999-08-22T00:00:00 GST.static final AbsoluteDateReference epoch for GLONASS four-year interval number: 1996-01-01T00:00:00 GLONASS time.static final AbsoluteDateReference epoch for GPS weeks: 1980-01-06T00:00:00 GPS time.static final AbsoluteDateJ2000.0 Reference epoch: 2000-01-01T12:00:00 Terrestrial Time (not UTC).static final AbsoluteDateJava Reference epoch: 1970-01-01T00:00:00 Universal Time Coordinate.static final AbsoluteDateReference epoch for julian dates: -4712-01-01T12:00:00 Terrestrial Time.static final AbsoluteDateReference epoch for modified julian dates: 1858-11-17T00:00:00 Terrestrial Time.static final AbsoluteDateReference epoch for NavIC weeks: 1999-08-22T00:00:00 NavIC time.static final AbsoluteDateDummy date at infinity in the past direction.static final AbsoluteDateReference epoch for QZSS weeks: 1980-01-06T00:00:00 QZSS time.Fields inherited from class org.orekit.time.TimeOffset
ATTOSECOND, DAY, DAY_WITH_POSITIVE_LEAP, FEMTOSECOND, HOUR, MICROSECOND, MILLISECOND, MINUTE, NaN, NANOSECOND, NEGATIVE_INFINITY, PICOSECOND, POSITIVE_INFINITY, SECOND, ZERO -
Constructor Summary
ConstructorsConstructorDescriptionCreate an instance with a default value (J2000_EPOCH).AbsoluteDate(int year, int month, int day, int hour, int minute, double second, TimeScale timeScale) Build an instance from a location in atime scale.AbsoluteDate(int year, int month, int day, int hour, int minute, TimeOffset second, TimeScale timeScale) Build an instance from a location in atime scale.AbsoluteDate(int year, int month, int day, TimeScale timeScale) Build an instance from a location in atime scale.AbsoluteDate(int year, Month month, int day, int hour, int minute, double second, TimeScale timeScale) Build an instance from a location in atime scale.AbsoluteDate(int year, Month month, int day, int hour, int minute, TimeOffset second, TimeScale timeScale) Build an instance from a location in atime scale.AbsoluteDate(int year, Month month, int day, TimeScale timeScale) Build an instance from a location in atime scale.AbsoluteDate(String location, TimeScale timeScale) Build an instance from a location (parsed from a string) in atime scale.AbsoluteDate(Instant instant) Build an instance from aninstantin utc time scale.AbsoluteDate(Instant instant, TimeScale timeScale) Build an instance from aninstantin atime scale.AbsoluteDate(Instant instant, UTCScale utcScale) Build an instance from aninstantin thetime scale.AbsoluteDate(Date location, TimeScale timeScale) Build an instance from a location in atime scale.AbsoluteDate(AbsoluteDate since, double elapsedDuration) Build an instance from an elapsed duration since another instant.AbsoluteDate(AbsoluteDate reference, double apparentOffset, TimeScale timeScale) Build an instance from an apparent clock offset with respect to another instant in the perspective of a specifictime scale.AbsoluteDate(AbsoluteDate since, long elapsedDuration, TimeUnit timeUnit) Build an instance from an elapsed duration since another instant.AbsoluteDate(AbsoluteDate since, TimeOffset elapsedDuration) Build an instance from an elapsed duration since another instant.AbsoluteDate(AbsoluteDate reference, TimeOffset apparentOffset, TimeScale timeScale) Build an instance from an apparent clock offset with respect to another instant in the perspective of a specifictime scale.AbsoluteDate(DateComponents date, TimeComponents time, TimeScale timeScale) Build an instance from a location in atime scale.AbsoluteDate(DateComponents date, TimeScale timeScale) Build an instance from a location in atime scale.AbsoluteDate(DateTimeComponents location, TimeScale timeScale) Build an instance from a location in atime scale.AbsoluteDate(TimeOffset offset) Build a date from an offset since a reference epoch. -
Method Summary
Modifier and TypeMethodDescriptionaccurateDurationFrom(AbsoluteDate instant) Compute the physically elapsed duration between two instants.accurateOffsetFrom(AbsoluteDate instant, TimeScale timeScale) Compute the apparent clock offset between two instant in the perspective of a specifictime scale.static AbsoluteDatecreateBesselianEpoch(double besselianEpoch) Build an instance corresponding to a Besselian Epoch (BE).static AbsoluteDatecreateJDDate(int jd, double secondsSinceNoon, TimeScale timeScale) Build an instance corresponding to a Julian Day date.static AbsoluteDatecreateJDDate(int jd, double secondsSinceNoon, TimeScale timeScale, TimeScale pivotTimeScale) Build an instance corresponding to a Julian Day date.static AbsoluteDatecreateJulianEpoch(double julianEpoch) Build an instance corresponding to a Julian Epoch (JE).static AbsoluteDatecreateMedian(AbsoluteDate date1, AbsoluteDate date2) Create an instance as the median data between two existing instances.static AbsoluteDatecreateMJDDate(int mjd, double secondsInDay, TimeScale timeScale) Build an instance corresponding to a Modified Julian Day date.static AbsoluteDatecreateMJDDate(int mjd, TimeOffset secondsInDay, TimeScale timeScale) Build an instance corresponding to a Modified Julian Day date.doubledurationFrom(AbsoluteDate instant) Compute the physically elapsed duration between two instants.longdurationFrom(AbsoluteDate instant, TimeUnit timeUnit) Compute the physically elapsed duration between two instants.getComponents(int minutesFromUTC) Split the instance into date/time components for a local time.getComponents(int minutesFromUTC, TimeScale utc) Split the instance into date/time components for a local time.getComponents(TimeZone timeZone) Split the instance into date/time components for a time zone.getComponents(TimeZone timeZone, TimeScale utc) Split the instance into date/time components for a time zone.getComponents(TimeScale timeScale) Split the instance into date/time components.getDate()Get the date.doublegetDayOfYear(TimeScale utc) Get day of year, preserving continuity as much as possible.doublegetJD()Return the given date as a Julian Date expressed in UTC.doubleReturn the given date as a Julian Date expressed in given timescale.doublegetMJD()Return the given date as a Modified Julian Date expressed in UTC.doubleReturn the given date as a Modified Julian Date expressed in given timescale.booleanisAfter(TimeStamped other) Check if the instance represents a time that is strictly after another.booleanisAfterOrEqualTo(TimeStamped other) Check if the instance represents a time that is after or equal to another.booleanisBefore(TimeStamped other) Check if the instance represents a time that is strictly before another.booleanisBeforeOrEqualTo(TimeStamped other) Check if the instance represents a time that is before or equal to another.booleanisBetween(TimeStamped boundary, TimeStamped otherBoundary) Check if the instance represents a time that is strictly between two others representing the boundaries of a time span.booleanisBetweenOrEqualTo(TimeStamped boundary, TimeStamped otherBoundary) Check if the instance represents a time that is between two others representing the boundaries of a time span, or equal to one of them.booleanisCloseTo(TimeStamped other, double tolerance) Check if the instance time is close to another.booleanisEqualTo(TimeStamped other) Check if the instance represents the same time as another.doubleoffsetFrom(AbsoluteDate instant, TimeScale timeScale) Compute the apparent clock offset between two instant in the perspective of a specifictime scale.static AbsoluteDateparseCCSDSCalendarSegmentedTimeCode(byte preambleField, byte[] timeField) Build an instance from a CCSDS Calendar Segmented Time Code (CCS).static AbsoluteDateparseCCSDSCalendarSegmentedTimeCode(byte preambleField, byte[] timeField, TimeScale utc) Build an instance from a CCSDS Calendar Segmented Time Code (CCS).static AbsoluteDateparseCCSDSDaySegmentedTimeCode(byte preambleField, byte[] timeField, DateComponents agencyDefinedEpoch) Build an instance from a CCSDS Day Segmented Time Code (CDS).static AbsoluteDateparseCCSDSDaySegmentedTimeCode(byte preambleField, byte[] timeField, DateComponents agencyDefinedEpoch, TimeScale utc) Build an instance from a CCSDS Day Segmented Time Code (CDS).static AbsoluteDateparseCCSDSUnsegmentedTimeCode(byte preambleField1, byte preambleField2, byte[] timeField, AbsoluteDate agencyDefinedEpoch) Build an instance from a CCSDS Unsegmented Time Code (CUC).static AbsoluteDateparseCCSDSUnsegmentedTimeCode(byte preambleField1, byte preambleField2, byte[] timeField, AbsoluteDate agencyDefinedEpoch, AbsoluteDate ccsdsEpoch) Build an instance from a CCSDS Unsegmented Time Code (CUC).shiftedBy(double dt) Get a time-shifted instance.Get a time-shifted date.shiftedBy(TimeOffset dt) Get a time-shifted instance.doubletimeScalesOffset(TimeScale scale1, TimeScale scale2) Compute the offset between two time scales at the current instant.Convert the instance to a JavaDate.Convert the instance to a JavaInstant.toInstant(TimeScales timeScales) Convert the instance to a JavaInstant.toString()Get a String representation of the instant location with up to 18 digits of precision for the seconds value.toString(int minutesFromUTC) Get a String representation of the instant location for a local time.Get a String representation of the instant location for a local time.Get a String representation of the instant location for a time zone.Get a String representation of the instant location for a time zone.Get a String representation of the instant location in ISO-8601 format without the UTC offset and with up to 16 digits of precision for the seconds value.toStringRfc3339(TimeScale utc) Represent the given date as a string according to the format in RFC 3339.toStringWithoutUtcOffset(TimeScale timeScale, int fractionDigits) Return a string representation of this date-time, rounded to the given precision.Methods inherited from class org.orekit.time.TimeOffset
add, compareTo, divide, equals, getAttoSeconds, getRoundedOffset, getRoundedTime, getSeconds, hashCode, isFinite, isInfinite, isNaN, isNegativeInfinity, isPositiveInfinity, isZero, multiply, negate, parse, subtract, toDoubleMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.orekit.time.TimeStamped
durationFrom
-
Field Details
-
JULIAN_EPOCH
Reference epoch for julian dates: -4712-01-01T12:00:00 Terrestrial Time.Both
java.util.DateandDateComponentsclasses follow the astronomical conventions and consider a year 0 between years -1 and +1, hence this reference date lies in year -4712 and not in year -4713 as can be seen in other documents or programs that obey a different convention (for example theconvcalutility).This constant uses the
default data context.- See Also:
-
MODIFIED_JULIAN_EPOCH
Reference epoch for modified julian dates: 1858-11-17T00:00:00 Terrestrial Time.This constant uses the
default data context.- See Also:
-
FIFTIES_EPOCH
Reference epoch for 1950 dates: 1950-01-01T00:00:00 Terrestrial Time.This constant uses the
default data context.- See Also:
-
CCSDS_EPOCH
Reference epoch for CCSDS Time Code Format (CCSDS 301.0-B-4): 1958-01-01T00:00:00 International Atomic Time (not UTC).This constant uses the
default data context.- See Also:
-
GALILEO_EPOCH
Reference epoch for Galileo System Time: 1999-08-22T00:00:00 GST.This constant uses the
default data context.- See Also:
-
GPS_EPOCH
Reference epoch for GPS weeks: 1980-01-06T00:00:00 GPS time.This constant uses the
default data context.- See Also:
-
QZSS_EPOCH
Reference epoch for QZSS weeks: 1980-01-06T00:00:00 QZSS time.This constant uses the
default data context.- See Also:
-
NAVIC_EPOCH
Reference epoch for NavIC weeks: 1999-08-22T00:00:00 NavIC time.This constant uses the
default data context.- See Also:
-
BEIDOU_EPOCH
Reference epoch for BeiDou weeks: 2006-01-01T00:00:00 UTC.This constant uses the
default data context.- See Also:
-
GLONASS_EPOCH
Reference epoch for GLONASS four-year interval number: 1996-01-01T00:00:00 GLONASS time.By convention, TGLONASS = UTC + 3 hours.
This constant uses the
default data context.- See Also:
-
J2000_EPOCH
J2000.0 Reference epoch: 2000-01-01T12:00:00 Terrestrial Time (not UTC).This constant uses the
default data context.- See Also:
-
JAVA_EPOCH
Java Reference epoch: 1970-01-01T00:00:00 Universal Time Coordinate.Between 1968-02-01 and 1972-01-01, UTC-TAI = 4.213 170 0s + (MJD - 39 126) x 0.002 592s. As on 1970-01-01 MJD = 40587, UTC-TAI = 8.000082s
This constant uses the
default data context.- See Also:
-
ARBITRARY_EPOCH
An arbitrary finite date. Uses when a non-null date is needed but its value doesn't matter. -
PAST_INFINITY
Dummy date at infinity in the past direction.- See Also:
-
FUTURE_INFINITY
Dummy date at infinity in the future direction.- See Also:
-
-
Constructor Details
-
AbsoluteDate
Create an instance with a default value (J2000_EPOCH).This constructor uses the
default data context.- See Also:
-
AbsoluteDate
Build an instance from a location (parsed from a string) in atime scale.The supported formats for location are mainly the ones defined in ISO-8601 standard, the exact subset is explained in
DateTimeComponents.parseDateTime(String),DateComponents.parseDate(String)andTimeComponents.parseTime(String).As CCSDS ASCII calendar segmented time code is a trimmed down version of ISO-8601, it is also supported by this constructor.
- Parameters:
location- location in the time scale, must be in a supported formattimeScale- time scale- Throws:
IllegalArgumentException- if location string is not in a supported format
-
AbsoluteDate
Build an instance from a location in atime scale.- Parameters:
location- location in the time scaletimeScale- time scale
-
AbsoluteDate
Build an instance from a location in atime scale.- Parameters:
date- date location in the time scaletime- time location in the time scaletimeScale- time scale
-
AbsoluteDate
public AbsoluteDate(int year, int month, int day, int hour, int minute, double second, TimeScale timeScale) throws IllegalArgumentException Build an instance from a location in atime scale.- Parameters:
year- year number (may be 0 or negative for BC years)month- month number from 1 to 12day- day number from 1 to 31hour- hour number from 0 to 23minute- minute number from 0 to 59second- second number from 0.0 to 60.0 (excluded)timeScale- time scale- Throws:
IllegalArgumentException- if inconsistent arguments are given (parameters out of range)
-
AbsoluteDate
public AbsoluteDate(int year, int month, int day, int hour, int minute, TimeOffset second, TimeScale timeScale) throws IllegalArgumentException Build an instance from a location in atime scale.- Parameters:
year- year number (may be 0 or negative for BC years)month- month number from 1 to 12day- day number from 1 to 31hour- hour number from 0 to 23minute- minute number from 0 to 59second- second number from 0.0 to 60.0 (excluded)timeScale- time scale- Throws:
IllegalArgumentException- if inconsistent arguments are given (parameters out of range)- Since:
- 13.0
-
AbsoluteDate
public AbsoluteDate(int year, Month month, int day, int hour, int minute, double second, TimeScale timeScale) throws IllegalArgumentException Build an instance from a location in atime scale.- Parameters:
year- year number (may be 0 or negative for BC years)month- month enumerateday- day number from 1 to 31hour- hour number from 0 to 23minute- minute number from 0 to 59second- second number from 0.0 to 60.0 (excluded)timeScale- time scale- Throws:
IllegalArgumentException- if inconsistent arguments are given (parameters out of range)
-
AbsoluteDate
public AbsoluteDate(int year, Month month, int day, int hour, int minute, TimeOffset second, TimeScale timeScale) throws IllegalArgumentException Build an instance from a location in atime scale.- Parameters:
year- year number (may be 0 or negative for BC years)month- month enumerateday- day number from 1 to 31hour- hour number from 0 to 23minute- minute number from 0 to 59second- second number from 0.0 to 60.0 (excluded)timeScale- time scale- Throws:
IllegalArgumentException- if inconsistent arguments are given (parameters out of range)- Since:
- 13.0
-
AbsoluteDate
Build an instance from a location in atime scale.The hour is set to 00:00:00.000.
- Parameters:
date- date location in the time scaletimeScale- time scale- Throws:
IllegalArgumentException- if inconsistent arguments are given (parameters out of range)
-
AbsoluteDate
public AbsoluteDate(int year, int month, int day, TimeScale timeScale) throws IllegalArgumentException Build an instance from a location in atime scale.The hour is set to 00:00:00.000.
- Parameters:
year- year number (may be 0 or negative for BC years)month- month number from 1 to 12day- day number from 1 to 31timeScale- time scale- Throws:
IllegalArgumentException- if inconsistent arguments are given (parameters out of range)
-
AbsoluteDate
public AbsoluteDate(int year, Month month, int day, TimeScale timeScale) throws IllegalArgumentException Build an instance from a location in atime scale.The hour is set to 00:00:00.000.
- Parameters:
year- year number (may be 0 or negative for BC years)month- month enumerateday- day number from 1 to 31timeScale- time scale- Throws:
IllegalArgumentException- if inconsistent arguments are given (parameters out of range)
-
AbsoluteDate
Build an instance from a location in atime scale.- Parameters:
location- location in the time scaletimeScale- time scale
-
AbsoluteDate
Build an instance from aninstantin atime scale.This constructor is provided for those users who wish to provide their own time scale to control how an
Instantis converted to anAbsoluteDate.Note that
Instantis documented to use the "Java Time Scale", which is a non-standard time scale that is not well defined, and Orekit does not support it. Notably it uses seconds that are not SI seconds.Instant's time scale may vary based on many factors, but is documented to be within 1 s of UTC after 1972-11-04T12:00.- Parameters:
instant- in thetimeScale.timeScale- of theInstant.- Since:
- 12.0
- See Also:
-
AbsoluteDate
Build an instance from aninstantin utc time scale.- Parameters:
instant- instant in the time scale- Since:
- 12.1
- See Also:
-
AbsoluteDate
Build an instance from aninstantin thetime scale.See the caveats of using
Instantas described in the otherconstructor.- Parameters:
instant- instant in the time scaleutcScale- utc time scale- Since:
- 12.1
- See Also:
-
AbsoluteDate
Build an instance from an elapsed duration since another instant.It is important to note that the elapsed duration is not the difference between two readings on a time scale. As an example, the duration between the two instants leading to the readings 2005-12-31T23:59:59 and 2006-01-01T00:00:00 in the
UTCtime scale is not 1 second, but a stop watch would have measured an elapsed duration of 2 seconds between these two instances because a leap second was introduced at the end of 2005 in this time scale.This constructor is the reverse of the
durationFrom(AbsoluteDate)method.- Parameters:
since- start instant of the measured durationelapsedDuration- physically elapsed duration from thesinceinstant, as measured in a regular time scale- See Also:
-
AbsoluteDate
Build an instance from an elapsed duration since another instant.It is important to note that the elapsed duration is not the difference between two readings on a time scale. As an example, the duration between the two instants leading to the readings 2005-12-31T23:59:59 and 2006-01-01T00:00:00 in the
UTCtime scale is not 1 second, but a stop watch would have measured an elapsed duration of 2 seconds between these two instances because a leap second was introduced at the end of 2005 in this time scale.This constructor is the reverse of the
durationFrom(AbsoluteDate)method.- Parameters:
since- start instant of the measured durationelapsedDuration- physically elapsed duration from thesinceinstant, as measured in a regular time scale- Since:
- 13.0
- See Also:
-
AbsoluteDate
Build an instance from an elapsed duration since another instant.It is important to note that the elapsed duration is not the difference between two readings on a time scale. As an example, the duration between the two instants leading to the readings 2005-12-31T23:59:59 and 2006-01-01T00:00:00 in the
UTCtime scale is not 1 second, but a stop watch would have measured an elapsed duration of 2 seconds between these two instances because a leap second was introduced at the end of 2005 in this time scale.This constructor is the reverse of the
durationFrom(AbsoluteDate, TimeUnit)method.- Parameters:
since- start instant of the measured durationelapsedDuration- physically elapsed duration from thesinceinstant, as measured in a regular time scaletimeUnit-TimeUnitof the elapsedDuration- Since:
- 12.1
- See Also:
-
AbsoluteDate
Build an instance from an apparent clock offset with respect to another instant in the perspective of a specifictime scale.It is important to note that the apparent clock offset is the difference between two readings on a time scale and not an elapsed duration. As an example, the apparent clock offset between the two instants leading to the readings 2005-12-31T23:59:59 and 2006-01-01T00:00:00 in the
UTCtime scale is 1 second, but the elapsed duration is 2 seconds because a leap second has been introduced at the end of 2005 in this time scale.This constructor is the reverse of the
offsetFrom(AbsoluteDate, TimeScale)method.- Parameters:
reference- reference instantapparentOffset- apparent clock offset from the reference instant (difference between two readings in the specified time scale)timeScale- time scale with respect to which the offset is defined- See Also:
-
AbsoluteDate
Build an instance from an apparent clock offset with respect to another instant in the perspective of a specifictime scale.It is important to note that the apparent clock offset is the difference between two readings on a time scale and not an elapsed duration. As an example, the apparent clock offset between the two instants leading to the readings 2005-12-31T23:59:59 and 2006-01-01T00:00:00 in the
UTCtime scale is 1 second, but the elapsed duration is 2 seconds because a leap second has been introduced at the end of 2005 in this time scale.This constructor is the reverse of the
offsetFrom(AbsoluteDate, TimeScale)method.- Parameters:
reference- reference instantapparentOffset- apparent clock offset from the reference instant (difference between two readings in the specified time scale)timeScale- time scale with respect to which the offset is defined- Since:
- 13.0
- See Also:
-
AbsoluteDate
Build a date from an offset since a reference epoch.- Parameters:
offset- offset since reference epoch 2000-01-01T12:00:00 TAI. (beware, it is notJ2000_EPOCHsince it is in TAI and not in TT)- Since:
- 13.0
-
-
Method Details
-
parseCCSDSUnsegmentedTimeCode
@DefaultDataContext public static AbsoluteDate parseCCSDSUnsegmentedTimeCode(byte preambleField1, byte preambleField2, byte[] timeField, AbsoluteDate agencyDefinedEpoch) Build an instance from a CCSDS Unsegmented Time Code (CUC).CCSDS Unsegmented Time Code is defined in the blue book: CCSDS Time Code Format (CCSDS 301.0-B-4) published in November 2010
If the date to be parsed is formatted using version 3 of the standard (CCSDS 301.0-B-3 published in 2002) or if the extension of the preamble field introduced in version 4 of the standard is not used, then the
preambleField2parameter can be set to 0.This method uses the
default data contextif the CCSDS epoch is used.- Parameters:
preambleField1- first byte of the field specifying the format, often not transmitted in data interfaces, as it is constant for a given data interfacepreambleField2- second byte of the field specifying the format (added in revision 4 of the CCSDS standard in 2010), often not transmitted in data interfaces, as it is constant for a given data interface (value ignored if presence not signaled inpreambleField1)timeField- byte array containing the time codeagencyDefinedEpoch- reference epoch, ignored if the preamble field specifies theCCSDS reference epochis used (and hence may be null in this case)- Returns:
- an instance corresponding to the specified date
- See Also:
-
parseCCSDSUnsegmentedTimeCode
public static AbsoluteDate parseCCSDSUnsegmentedTimeCode(byte preambleField1, byte preambleField2, byte[] timeField, AbsoluteDate agencyDefinedEpoch, AbsoluteDate ccsdsEpoch) Build an instance from a CCSDS Unsegmented Time Code (CUC).CCSDS Unsegmented Time Code is defined in the blue book: CCSDS Time Code Format (CCSDS 301.0-B-4) published in November 2010
If the date to be parsed is formatted using version 3 of the standard (CCSDS 301.0-B-3 published in 2002) or if the extension of the preamble field introduced in version 4 of the standard is not used, then the
preambleField2parameter can be set to 0.- Parameters:
preambleField1- first byte of the field specifying the format, often not transmitted in data interfaces, as it is constant for a given data interfacepreambleField2- second byte of the field specifying the format (added in revision 4 of the CCSDS standard in 2010), often not transmitted in data interfaces, as it is constant for a given data interface (value ignored if presence not signaled inpreambleField1)timeField- byte array containing the time codeagencyDefinedEpoch- reference epoch, ignored if the preamble field specifies theCCSDS reference epochis used (and hence may be null in this case, but thenccsdsEpochmust be non-null)ccsdsEpoch- reference epoch, ignored if the preamble field specifies the agency epoch is used (and hence may be null in this case, but thenagencyDefinedEpochmust be non-null).- Returns:
- an instance corresponding to the specified date
- Since:
- 10.1
-
parseCCSDSDaySegmentedTimeCode
@DefaultDataContext public static AbsoluteDate parseCCSDSDaySegmentedTimeCode(byte preambleField, byte[] timeField, DateComponents agencyDefinedEpoch) Build an instance from a CCSDS Day Segmented Time Code (CDS).CCSDS Day Segmented Time Code is defined in the blue book: CCSDS Time Code Format (CCSDS 301.0-B-4) published in November 2010
This method uses the
default data context.- Parameters:
preambleField- field specifying the format, often not transmitted in data interfaces, as it is constant for a given data interfacetimeField- byte array containing the time codeagencyDefinedEpoch- reference epoch, ignored if the preamble field specifies theCCSDS reference epochis used (and hence may be null in this case)- Returns:
- an instance corresponding to the specified date
- See Also:
-
parseCCSDSDaySegmentedTimeCode
public static AbsoluteDate parseCCSDSDaySegmentedTimeCode(byte preambleField, byte[] timeField, DateComponents agencyDefinedEpoch, TimeScale utc) Build an instance from a CCSDS Day Segmented Time Code (CDS).CCSDS Day Segmented Time Code is defined in the blue book: CCSDS Time Code Format (CCSDS 301.0-B-4) published in November 2010
- Parameters:
preambleField- field specifying the format, often not transmitted in data interfaces, as it is constant for a given data interfacetimeField- byte array containing the time codeagencyDefinedEpoch- reference epoch, ignored if the preamble field specifies theCCSDS reference epochis used (and hence may be null in this case)utc- time scale used to compute date and time components.- Returns:
- an instance corresponding to the specified date
- Since:
- 10.1
-
parseCCSDSCalendarSegmentedTimeCode
@DefaultDataContext public static AbsoluteDate parseCCSDSCalendarSegmentedTimeCode(byte preambleField, byte[] timeField) Build an instance from a CCSDS Calendar Segmented Time Code (CCS).CCSDS Calendar Segmented Time Code is defined in the blue book: CCSDS Time Code Format (CCSDS 301.0-B-4) published in November 2010
This method uses the
default data context.- Parameters:
preambleField- field specifying the format, often not transmitted in data interfaces, as it is constant for a given data interfacetimeField- byte array containing the time code- Returns:
- an instance corresponding to the specified date
- See Also:
-
parseCCSDSCalendarSegmentedTimeCode
public static AbsoluteDate parseCCSDSCalendarSegmentedTimeCode(byte preambleField, byte[] timeField, TimeScale utc) Build an instance from a CCSDS Calendar Segmented Time Code (CCS).CCSDS Calendar Segmented Time Code is defined in the blue book: CCSDS Time Code Format (CCSDS 301.0-B-4) published in November 2010
- Parameters:
preambleField- field specifying the format, often not transmitted in data interfaces, as it is constant for a given data interfacetimeField- byte array containing the time codeutc- time scale used to compute date and time components.- Returns:
- an instance corresponding to the specified date
- Since:
- 10.1
-
createJDDate
Build an instance corresponding to a Julian Day date.- Parameters:
jd- Julian daysecondsSinceNoon- seconds in the Julian day (BEWARE, Julian days start at noon, so 0.0 is noon)timeScale- time scale in which the seconds in day are defined- Returns:
- a new instant
-
createJDDate
public static AbsoluteDate createJDDate(int jd, double secondsSinceNoon, TimeScale timeScale, TimeScale pivotTimeScale) Build an instance corresponding to a Julian Day date.This function should be preferred to
createMJDDate(int, double, TimeScale)when the target time scale has a non-constant offset with respect to TAI.The idea is to introduce a pivot time scale that is close to the target time scale but has a constant bias with TAI.
For example, to get a date from an MJD in TDB time scale, it's advised to use the TT time scale as a pivot scale. TT is very close to TDB and has constant offset to TAI.
- Parameters:
jd- Julian daysecondsSinceNoon- seconds in the Julian day (BEWARE, Julian days start at noon, so 0.0 is noon)timeScale- timescale in which the seconds in day are definedpivotTimeScale- pivot timescale used as intermediate timescale- Returns:
- a new instant
-
createMJDDate
public static AbsoluteDate createMJDDate(int mjd, double secondsInDay, TimeScale timeScale) throws OrekitIllegalArgumentException Build an instance corresponding to a Modified Julian Day date.- Parameters:
mjd- modified Julian daysecondsInDay- seconds in the daytimeScale- time scale in which the seconds in day are defined- Returns:
- a new instant
- Throws:
OrekitIllegalArgumentException- if seconds number is out of range
-
createMJDDate
public static AbsoluteDate createMJDDate(int mjd, TimeOffset secondsInDay, TimeScale timeScale) throws OrekitIllegalArgumentException Build an instance corresponding to a Modified Julian Day date.- Parameters:
mjd- modified Julian daysecondsInDay- seconds in the daytimeScale- time scale in which the seconds in day are defined- Returns:
- a new instant
- Throws:
OrekitIllegalArgumentException- if seconds number is out of range- Since:
- 13.0
-
createMedian
Create an instance as the median data between two existing instances.- Parameters:
date1- first instancedate2- second instance- Returns:
- median date between first and second instance
- Since:
- 13.0
-
createJulianEpoch
Build an instance corresponding to a Julian Epoch (JE).According to Lieske paper: Precession Matrix Based on IAU (1976) System of Astronomical Constants, Astronomy and Astrophysics, vol. 73, no. 3, Mar. 1979, p. 282-284, Julian Epoch is related to Julian Ephemeris Date as:
JE = 2000.0 + (JED - 2451545.0) / 365.25
This method reverts the formula above and computes an
AbsoluteDatefrom the Julian Epoch.This method uses the
default data context.- Parameters:
julianEpoch- Julian epoch, like 2000.0 for defining the classical reference J2000.0- Returns:
- a new instant
- See Also:
-
createBesselianEpoch
Build an instance corresponding to a Besselian Epoch (BE).According to Lieske paper: Precession Matrix Based on IAU (1976) System of Astronomical Constants, Astronomy and Astrophysics, vol. 73, no. 3, Mar. 1979, p. 282-284, Besselian Epoch is related to Julian Ephemeris Date as:
BE = 1900.0 + (JED - 2415020.31352) / 365.242198781
This method reverts the formula above and computes an
AbsoluteDatefrom the Besselian Epoch.This method uses the
default data context.- Parameters:
besselianEpoch- Besselian epoch, like 1950 for defining the classical reference B1950.0- Returns:
- a new instant
- See Also:
-
shiftedBy
Get a time-shifted instance.- Specified by:
shiftedByin interfaceTimeShiftable<AbsoluteDate>- Parameters:
dt- time shift in seconds- Returns:
- a new instance, shifted with respect to instance (which is not changed)
-
shiftedBy
Get a time-shifted instance.- Specified by:
shiftedByin interfaceTimeShiftable<AbsoluteDate>- Parameters:
dt- time shift- Returns:
- a new instance, shifted with respect to instance (which is not changed)
-
shiftedBy
Get a time-shifted date.Calling this method is equivalent to call
new AbsoluteDate(this, shift, timeUnit).- Parameters:
dt- time shift in time unitstimeUnit-TimeUnitof the shift- Returns:
- a new date, shifted with respect to instance (which is immutable)
- Since:
- 12.1
-
durationFrom
Compute the physically elapsed duration between two instants.The returned duration is the number of seconds physically elapsed between the two instants, measured in a regular time scale with respect to surface of the Earth (i.e either the
TAI scale, theTT scaleor theGPS scale). It is the only method that gives a duration with a physical meaning.This method gives the same result (with less computation) as calling
offsetFrom(AbsoluteDate, TimeScale)with a second argument set to one of the regular scales cited above.This method is the reverse of the
AbsoluteDate(AbsoluteDate, double)constructor.- Parameters:
instant- instant to subtract from the instance- Returns:
- offset in seconds between the two instants (positive if the instance is posterior to the argument)
- See Also:
-
accurateDurationFrom
Compute the physically elapsed duration between two instants.The returned duration is the number of seconds physically elapsed between the two instants, measured in a regular time scale with respect to surface of the Earth (i.e either the
TAI scale, theTT scaleor theGPS scale). It is the only method that gives a duration with a physical meaning.This method gives the same result (with less computation) as calling
offsetFrom(AbsoluteDate, TimeScale)with a second argument set to one of the regular scales cited above.This method is the reverse of the
AbsoluteDate(AbsoluteDate, double)constructor.- Parameters:
instant- instant to subtract from the instance- Returns:
- offset in seconds between the two instants (positive if the instance is posterior to the argument)
- Since:
- 13.0
- See Also:
-
durationFrom
Compute the physically elapsed duration between two instants.The returned duration is the duration physically elapsed between the two instants, using the given time unit and rounded to the nearest integer, measured in a regular time scale with respect to surface of the Earth (i.e either the
TAI scale, theTT scaleor theGPS scale). It is the only method that gives a duration with a physical meaning.This method is the reverse of the
AbsoluteDate(AbsoluteDate, long, TimeUnit)constructor. -
offsetFrom
Compute the apparent clock offset between two instant in the perspective of a specifictime scale.The offset is the number of seconds counted in the given time scale between the locations of the two instants, with all time scale irregularities removed (i.e. considering all days are exactly 86400 seconds long). This method will give a result that may not have a physical meaning if the time scale is irregular. For example since a leap second was introduced at the end of 2005, the apparent clock offset between 2005-12-31T23:59:59 and 2006-01-01T00:00:00 is 1 second and is the value this method will return. On the other hand, the physical duration of the corresponding time interval as returned by the
durationFrom(AbsoluteDate)method is 2 seconds.This method is the reverse of the
AbsoluteDate(AbsoluteDate, double, TimeScale)constructor.- Parameters:
instant- instant to subtract from the instancetimeScale- time scale with respect to which the offset should be computed- Returns:
- apparent clock offset in seconds between the two instants (positive if the instance is posterior to the argument)
- See Also:
-
accurateOffsetFrom
Compute the apparent clock offset between two instant in the perspective of a specifictime scale.The offset is the number of seconds counted in the given time scale between the locations of the two instants, with all time scale irregularities removed (i.e. considering all days are exactly 86400 seconds long). This method will give a result that may not have a physical meaning if the time scale is irregular. For example since a leap second was introduced at the end of 2005, the apparent clock offset between 2005-12-31T23:59:59 and 2006-01-01T00:00:00 is 1 second and is the value this method will return. On the other hand, the physical duration of the corresponding time interval as returned by the
durationFrom(AbsoluteDate)method is 2 seconds.This method is the reverse of the
AbsoluteDate(AbsoluteDate, double, TimeScale)constructor.- Parameters:
instant- instant to subtract from the instancetimeScale- time scale with respect to which the offset should be computed- Returns:
- apparent clock offset in seconds between the two instants (positive if the instance is posterior to the argument)
- Since:
- 13.0
- See Also:
-
timeScalesOffset
Compute the offset between two time scales at the current instant.The offset is defined as l₁-l₂ where l₁ is the location of the instant in the
scale1time scale and l₂ is the location of the instant in thescale2time scale.- Parameters:
scale1- first time scalescale2- second time scale- Returns:
- offset in seconds between the two time scales at the current instant
-
toDate
Convert the instance to a JavaDate.Conversion to the Date class induces a loss of precision because the Date class does not provide sub-millisecond information. Java Dates are considered to be locations in some times scales.
- Parameters:
timeScale- time scale to use- Returns:
- a
Dateinstance representing the location of the instant in the time scale
-
toInstant
Convert the instance to a JavaInstant. Nanosecond precision is preserved during this conversion- Returns:
- a
Instantinstance representing the location of the instant in the utc time scale - Since:
- 12.1
-
toInstant
Convert the instance to a JavaInstant. Nanosecond precision is preserved during this conversion- Parameters:
timeScales- the timescales to use- Returns:
- a
Instantinstance representing the location of the instant in the utc time scale - Since:
- 12.1
-
getComponents
Split the instance into date/time components.- Parameters:
timeScale- time scale to use- Returns:
- date/time components
-
getComponents
Split the instance into date/time components for a local time.This method uses the
default data context.- Parameters:
minutesFromUTC- offset in minutes from UTC (positive Eastwards UTC, negative Westward UTC)- Returns:
- date/time components
- Since:
- 7.2
- See Also:
-
getComponents
Split the instance into date/time components for a local time.- Parameters:
minutesFromUTC- offset in minutes from UTC (positive Eastwards UTC, negative Westward UTC)utc- time scale used to compute date and time components.- Returns:
- date/time components
- Since:
- 10.1
-
getComponents
Split the instance into date/time components for a time zone.This method uses the
default data context.- Parameters:
timeZone- time zone- Returns:
- date/time components
- Since:
- 7.2
- See Also:
-
getComponents
Split the instance into date/time components for a time zone.- Parameters:
timeZone- time zoneutc- time scale used to computed date and time components.- Returns:
- date/time components
- Since:
- 10.1
-
getDate
Get the date.- Specified by:
getDatein interfaceTimeStamped- Returns:
- date attached to the object
-
isEqualTo
Check if the instance represents the same time as another.- Parameters:
other- the instant to compare this date to- Returns:
- true if the instance and the argument refer to the same instant
- Since:
- 10.1
- See Also:
-
isCloseTo
Check if the instance time is close to another.- Parameters:
other- the instant to compare this date totolerance- the separation, in seconds, under which the two instants will be considered close to each other- Returns:
- true if the duration between the instance and the argument is strictly below the tolerance
- Since:
- 10.1
- See Also:
-
isBefore
Check if the instance represents a time that is strictly before another.- Parameters:
other- the instant to compare this date to- Returns:
- true if the instance is strictly before the argument when ordering chronologically
- Since:
- 10.1
- See Also:
-
isAfter
Check if the instance represents a time that is strictly after another.- Parameters:
other- the instant to compare this date to- Returns:
- true if the instance is strictly after the argument when ordering chronologically
- Since:
- 10.1
- See Also:
-
isBeforeOrEqualTo
Check if the instance represents a time that is before or equal to another.- Parameters:
other- the instant to compare this date to- Returns:
- true if the instance is before (or equal to) the argument when ordering chronologically
- Since:
- 10.1
- See Also:
-
isAfterOrEqualTo
Check if the instance represents a time that is after or equal to another.- Parameters:
other- the instant to compare this date to- Returns:
- true if the instance is after (or equal to) the argument when ordering chronologically
- Since:
- 10.1
- See Also:
-
isBetween
Check if the instance represents a time that is strictly between two others representing the boundaries of a time span. The two boundaries can be provided in any order: in other words, whetherboundaryrepresents a time that is before or afterotherBoundarywill not change the result of this method.- Parameters:
boundary- one end of the time spanotherBoundary- the other end of the time span- Returns:
- true if the instance is strictly between the two arguments when ordering chronologically
- Since:
- 10.1
- See Also:
-
isBetweenOrEqualTo
Check if the instance represents a time that is between two others representing the boundaries of a time span, or equal to one of them. The two boundaries can be provided in any order: in other words, whetherboundaryrepresents a time that is before or afterotherBoundarywill not change the result of this method.- Parameters:
boundary- one end of the time spanotherBoundary- the other end of the time span- Returns:
- true if the instance is between the two arguments (or equal to at least one of them) when ordering chronologically
- Since:
- 10.1
- See Also:
-
toString
Get a String representation of the instant location with up to 18 digits of precision for the seconds value.Since this method is used in exception messages and error handling every effort is made to return some representation of the instant. If UTC is available from the default data context then it is used to format the string in UTC. If not then TAI is used. Finally if the prior attempts fail this method falls back to converting this class's internal representation to a string.
This method uses the
default data context.- Overrides:
toStringin classTimeOffset- Returns:
- a string representation of the instance, in ISO-8601 format if UTC is available from the default data context.
- See Also:
-
toString
Get a String representation of the instant location in ISO-8601 format without the UTC offset and with up to 16 digits of precision for the seconds value.- Parameters:
timeScale- time scale to use- Returns:
- a string representation of the instance.
- See Also:
-
toString
Get a String representation of the instant location for a local time.This method uses the
default data context.- Parameters:
minutesFromUTC- offset in minutes from UTC (positive Eastwards UTC, negative Westward UTC).- Returns:
- string representation of the instance, in ISO-8601 format with milliseconds accuracy
- Since:
- 7.2
- See Also:
-
toString
Get a String representation of the instant location for a local time.- Parameters:
minutesFromUTC- offset in minutes from UTC (positive Eastwards UTC, negative Westward UTC).utc- time scale used to compute date and time components.- Returns:
- string representation of the instance, in ISO-8601 format with milliseconds accuracy
- Since:
- 10.1
- See Also:
-
toString
Get a String representation of the instant location for a time zone.This method uses the
default data context.- Parameters:
timeZone- time zone- Returns:
- string representation of the instance, in ISO-8601 format with milliseconds accuracy
- Since:
- 7.2
- See Also:
-
toString
Get a String representation of the instant location for a time zone.- Parameters:
timeZone- time zoneutc- time scale used to compute date and time components.- Returns:
- string representation of the instance, in ISO-8601 format with milliseconds accuracy
- Since:
- 10.1
- See Also:
-
toStringRfc3339
Represent the given date as a string according to the format in RFC 3339. RFC3339 is a restricted subset of ISO 8601 with a well defined grammar. Enough digits are included in the seconds value to avoid rounding up to the next minute.This method is different than
toString(TimeScale)in that it includes a"Z"at the end to indicate the time zone and enough precision to represent the point in time without rounding up to the next minute.RFC3339 is unable to represent BC years, years of 10000 or more, time zone offsets of 100 hours or more, or NaN. In these cases the value returned from this method will not be valid RFC3339 format.
- Parameters:
utc- time scale.- Returns:
- RFC 3339 format string.
- See Also:
-
toStringWithoutUtcOffset
Return a string representation of this date-time, rounded to the given precision.The format used is ISO8601 without the UTC offset.
Calling
toStringWithoutUtcOffset(DataContext.getDefault().getTimeScales().getUTC(), 3)will emulate the behavior oftoString()in Orekit 10 and earlier. Note this method is more accurate as it correctly handles rounding during leap seconds.- Parameters:
timeScale- to use to compute components.fractionDigits- the number of digits to include after the decimal point in the string representation of the seconds. The date and time is first rounded as necessary.fractionDigitsmust be greater than or equal to0.- Returns:
- string representation of this date, time, and UTC offset
- Since:
- 11.1
- See Also:
-
getMJD
Return the given date as a Modified Julian Date expressed in UTC.- Returns:
- double representation of the given date as Modified Julian Date.
- Since:
- 12.2
-
getMJD
Return the given date as a Modified Julian Date expressed in given timescale.- Parameters:
ts- time scale- Returns:
- double representation of the given date as Modified Julian Date.
- Since:
- 12.2
-
getJD
Return the given date as a Julian Date expressed in UTC.- Returns:
- double representation of the given date as Julian Date.
- Since:
- 12.2
-
getJD
Return the given date as a Julian Date expressed in given timescale.- Parameters:
ts- time scale- Returns:
- double representation of the given date as Julian Date.
- Since:
- 12.2
-
getDayOfYear
Get day of year, preserving continuity as much as possible.This is a continuous extension of the integer value returned by
getComponents(utc).getDate().getDayOfYear(). In order to have it remain as close as possible to its integer counterpart, day 1.0 is considered to occur on January 1st at noon.Continuity is preserved from day to day within a year, but of course there is a discontinuity at year change, where it switches from 365.49999… (or 366.49999… on leap years) to 0.5
- Parameters:
utc- time scale to compute date components- Returns:
- day of year, with day 1.0 occurring on January first at noon
- Since:
- 13.0
-