Package gov.nasa.jpl.time
Class Time
java.lang.Object
gov.nasa.jpl.time.Time
- All Implemented Interfaces:
ConvertableFromString
,Comparable<Time>
- Direct Known Subclasses:
EpochRelativeTime
This class is a SPICE-backed object-oriented way to represent Time in Java. It is intended to be imported and
used/passed around as the sole way your program represents time, except for exporting to other files or programs.
It represents time as TAI 10-nanosecond tics, so calculations should generally be accurate to well within a microsecond
(though some SPICE calls have inherent uncertainty greater than that). It is backed by not a floating point number
so it is suitable to discrete event simulators where there can be no ambiguity as to the ordering of times, and to
allow comparison, addition, and multiplication without having to make SPICE calls (they are only made for creating
times and exporting formats).
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionTime()
This is the empty time constructor, which will use 0 tics for the time input.protected
Time
(long tics) This protected constructor is used by the fromX and valueOf methods to actually assign the backing data.Copy constructor, also used for EpochRelativeTimeThe main Time constructor, that wraps str2et in SPICE if it is enabled, or a Java DateTime if it is not. -
Method Summary
Modifier and TypeMethodDescriptionReturns a Duration that is the absolute difference between the calling object and the parameterAdding a time and duration returns a timeRounds the time up to the input resolution, based on the reference time.Rounds the time up to the input resolution, based on the reference time.int
static Time
Return the current system time as a Time object.static Duration
Wraps downleg(t, sc_id, body_id), but always passes body_id = EARTH_NAIF_ID (Earth) Uses default spacecraft id.static Duration
Wraps downleg(t, sc_id, body_id), but always passes body_id = EARTH_NAIF_ID (Earth)static Duration
Wraps downleg(t, sc_id, body_id, time_reference) but always passes in "SCET" as time referenceboolean
boolean
equalToWithin
(Time t2, Duration resolution) Compares the time to another time object and returns true if t2 is within an input resolution of t1.static Time
Returns the input earth receive time - the downleg time from the spacecraft - the upleg time to the spacecraft when the signal was sent.static Time
Returns the input earth receive time - the downleg time from the spacecraft - the upleg time to the spacecraft when the signal was sent.static Time
Returns the input spacecraft event time - upleg time to the spacecraft.static Time
Returns the input spacecraft event time - upleg time to the spacecraft.static Time
Returns the input earth transmit time + the upleg time to the spacecraft + the downleg time from the spacecraft when the signal arrives at the spacecraft.static Time
Returns the input earth transmit time + the upleg time to the spacecraft + the downleg time from the spacecraft when the signal arrives at the spacecraft.static Time
Returns the input earth transmit time + the upleg time to the spacecraft.static Time
Returns the input earth transmit time + the upleg time to the spacecraft.Rounds the time down to the input resolution, based on the reference time.Rounds the time down to the input resolution, based on the reference time.static Time
fromET
(double ephemerisTime) Creates a Time object from Spice ET secondsstatic Time
fromExcelUTC
(String excelFormattedDate) Turns excel-formatted UTC datetime string into Time object.static Time
static Time
fromGPSSeconds
(double gpsSeconds) static Time
Returns a Time object equivalent to the input LMST string.static Time
Returns a Time object equivalent to the input LMST stringstatic Time
Returns a Time object that is equivalent to a given SCLK string.static Time
Returns a Time object that is equivalent to a given SCLK stringstatic Time
fromSCLKD
(double sclkd) Creates a time object given a SCLK decimal.static Time
fromSCLKD
(double sclkd, int sc_id) Creates a time object given a SCLK decimal and a SC NAIF idstatic Time
fromTAI
(double TAI) Creates a Time object from Spice TAI secondsstatic Time
fromTDBString
(String etString) Creates a time object from a time in the TDB (Spice ET) system formatted in ISOCstatic Time
fromTics
(long tics) Creates a time object given the number of tics (NOT seconds).static Time
Returns a new Time object given a Java ZonedDateTime - converts to UTC, then feeds that String to standard Time constructorstatic Time
fromTimezoneString
(String timeString, String timezone) Returns a new Time object given a local Time and the timezone that Time is in - converts to UTC, then feeds that String to standard Time constructorstatic String
Returns the default LST body frame and checks that it is not null.static Integer
Returns the current default spacecraft id and checks to make sure that it is not null.static int
Returns the current default output decimal precision.static Time
static int
Returns the current default spacecraft id and checks to make sure that it is not null.static Time
For XMLTOL use only - in UTC seconds since 1970 since that is the speclong
getTics()
static Time
boolean
greaterThan
(Time t2) Returns true if the parameter is after the calling object in timeboolean
Returns true if the parameter is after the calling object in time or if they represent the same timeint
hashCode()
boolean
Returns true if the parameter is before the calling object in timeboolean
Returns true if the parameter is before the calling object in time or if they represent the same timestatic Time
Returns the latest of a list of times.static Time
Returns the earliest of a list of times.Syntactic sugar for subtract(Duration)Syntactic sugar for subtract(Time)Syntactic sugar for add()Rounds the time to the input resolution, based on the reference time.Rounds the time to the input resolution, based on the reference time.Returns the RTLT as a duration object.static Time
Returns the input spacecraft event time + the downleg time from the spacecraft.static Time
Returns the input spacecraft event time + the downleg time from the spacecraft.static Time
Returns the input spacecraft time - the upleg time to the spacecraft.static Time
Returns the input spacecraft time - the upleg time to the spacecraft.static void
setDefaultLstBodyFrame
(String defaultLstBodyFrame) Sets the default LST body frame, which is tied to the naif body id.static void
setDefaultLstBodyId
(Integer bodyId) Updates the default body id for LST methods.static void
setDefaultOutputPrecision
(int defaultOutputPrecision) Sets the default output decimal precision.static void
setDefaultSpacecraftId
(Integer spacecraftId) Updates the default spacecraft id for convenience methods.static void
setLightTimeProvider
(LightTimeProvider inProvider) Call this before trying time frame conversions if you don't want to use SPICE for lighttimestatic void
setUseSpiceForMath
(boolean shouldUseSpiceForMath) call this before you start making Time objects if you want Java datetime to do the conversion to and from strings instead of SPICESubtracting a duration from a Time returns another TimeSubtracting two times returns a durationOutputs a string representing a time with the default number of decimal precisiontoCalendar
(int precision) Outputs a string representing a time with the given number of decimal precisiondouble
toET()
Converts the calling Time object to Spice ephemeris timetoExcelUTC
(boolean fourDigitYear) double
The calling object Time expressed as a sol-fraction since the LMST epoch.double
toFractionalSols
(int sc_id) The calling object Time expressed as a sol-fraction since the LMST epoch.toGPS
(int precision) double
toISOC()
Outputs a string representing a time with the default number of decimal precisiontoISOC
(int precision) Outputs a string representing a time with the given number of decimal precisiontoJulian()
Outputs a string representing a time with the default number of decimal precisiontoJulian
(int precision) Outputs a string representing a time with the given number of decimal precisiontoLMST()
Wraps toLMST but uses default spacecraft id and precisiontoLMST
(int precision) Wraps toLMST but uses default spacecraft id.toLMST
(int sc_id, int precision) Outputs a string that represents this instant in Local Mean Solar Time (LMST) for the SC specifiedReturns whether or not the LMST time is before noon as an AM_PM enum object.toLmstAmPm
(int sc_id) Returns whether or not the LMST time is before noon as an AM_PM enum object.toLST()
Wraps toLST but uses default spacecraft id, body id and frame.toLST
(int sc_id) Wraps toLST but uses default body id and frame.Gets the local solar time at a SC's location given that body ID and body frame.toLTST()
Wraps toLTST but uses default spacecraft id, body id and body frame.toLTST
(int sc_id) Wraps toLTST but uses default body id and frame.Calculates the LMST-assisted Local True Solar Time (LTST) value for the calling Time object.toSCLK()
Outputs the SCLK string that is equivalent to the calling object.toSCLK
(int sc_id) Outputs the SCLK string that is equivalent to the calling object.double
toSCLKD()
Outputs the SCLK decimal that is equivalent to the calling object.double
toSCLKD
(int sc_id) Outputs the SCLK decimal that is equivalent to the calling object.int
The integer sol number at the calling object Time.int
toSolNumber
(int sc_id) The integer sol number at the calling object Time.toString()
Overrides the default toString() method so you get a default representation of the object.double
toTAI()
Outputs a double representing the time in SPICE TAItoTimezone
(String timezone) Returns a ZonedDateTime that is equivalent to the calling Time object.toTimezoneString
(String timezone) Wraps toTimezoneString but uses default precision.toTimezoneString
(String timezone, int precision) Returns a string representing the calling object instant moved to a different timezonetoUTC()
Returns a utc string with the default precision.toUTC
(int precision) Outputs a string representing a time with the given number of decimal precisionReturns whether or not the UTC time is before noon as an AM_PM enum object.static Duration
Wraps upleg(t, sc_id, body_id), but always passes body_id = EARTH_NAIF_ID (Earth) Uses default spacecraft idstatic Duration
Wraps upleg(t, sc_id, body_id), but always passes body_id = EARTH_NAIF_ID (Earth)static Duration
Wraps upleg(t, sc_id, body_id, time_reference) but always passes in "SCET" as time referencevoid
Given a UTC time format (anything allowed by str2et), mutates the calling object to represent that time Implements the convertableFromString interface so engines can call valueOf on whatever object including Times.
-
Field Details
-
tics
protected long tics -
MAX_TIME
-
TIME_REGEX
- See Also:
-
TIME_PATTERN
-
SCLK_REGEX
- See Also:
-
SCLK_PATTERN
-
SCLKD_REGEX
- See Also:
-
SCLKD_PATTERN
-
LMST_STANDARD_REGEX
- See Also:
-
LMST_STANDARD_REGEX_PATTERN
-
LMST_SPICE_REGEX
- See Also:
-
LMST_SPICE_REGEX_PATTERN
-
-
Constructor Details
-
Time
The main Time constructor, that wraps str2et in SPICE if it is enabled, or a Java DateTime if it is not.- Parameters:
t
- Time string. When using SPICE, it can be any of the input formats that str2et supports (there are a lot)
-
Time
protected Time(long tics) This protected constructor is used by the fromX and valueOf methods to actually assign the backing data. -
Time
public Time()This is the empty time constructor, which will use 0 tics for the time input. It is needed when you need to create Time objects then assign them a value later (which should be a rare case). -
Time
Copy constructor, also used for EpochRelativeTime
-
-
Method Details
-
setUseSpiceForMath
public static void setUseSpiceForMath(boolean shouldUseSpiceForMath) call this before you start making Time objects if you want Java datetime to do the conversion to and from strings instead of SPICE -
setDefaultSpacecraftId
Updates the default spacecraft id for convenience methods.- Parameters:
spacecraftId
-
-
setLightTimeProvider
Call this before trying time frame conversions if you don't want to use SPICE for lighttime -
getDefaultSpacecraftId
public static int getDefaultSpacecraftId()Returns the current default spacecraft id and checks to make sure that it is not null.- Returns:
-
setDefaultLstBodyId
Updates the default body id for LST methods. This would be set to 499 for Mars surface missions, for example.- Parameters:
bodyId
-
-
getDefaultLstBodyId
Returns the current default spacecraft id and checks to make sure that it is not null.- Returns:
-
setDefaultLstBodyFrame
Sets the default LST body frame, which is tied to the naif body id.- Parameters:
defaultLstBodyFrame
-
-
getDefaultLstBodyFrame
Returns the default LST body frame and checks that it is not null.- Returns:
-
setDefaultOutputPrecision
public static void setDefaultOutputPrecision(int defaultOutputPrecision) Sets the default output decimal precision.- Parameters:
defaultOutputPrecision
-
-
getDefaultOutputPrecision
public static int getDefaultOutputPrecision()Returns the current default output decimal precision.- Returns:
-
getUnixEpoch
- Returns:
- A Time object representing the Unix 0 time
-
getGPSEpoch
- Returns:
- A Time object representing the GPS epoch
-
getDefaultReferenceTime
- Returns:
- A time object representing Jan 1 2000 00:00:00, to give a reference for time rounding up or down
-
getTics
public long getTics()- Returns:
- returns the number of 10-nanosecond tics since the reference time 2000-001T12:00:00 (not exactly) - DO NOT use this to do your own manual math, just for I/O
-
add
Adding a time and duration returns a time- Parameters:
d
- The Duration you want to add to the calling Time object- Returns:
- A new Time object
-
plus
Syntactic sugar for add()- Parameters:
d
-- Returns:
- A new Time object
-
subtract
Subtracting a duration from a Time returns another Time- Parameters:
d
- The Duration you want to subtract from the calling Time object- Returns:
- A new Time object
-
minus
Syntactic sugar for subtract(Duration)- Parameters:
d
-- Returns:
- A new Time object
-
subtract
Subtracting two times returns a duration- Parameters:
t2
- The time you want to subtract from the calling Time object- Returns:
- A new Duration object representing the length of time elapsed from the parameter to the calling object
-
minus
Syntactic sugar for subtract(Time)- Parameters:
t2
-- Returns:
- A new Duration object
-
absoluteDifference
Returns a Duration that is the absolute difference between the calling object and the parameter- Parameters:
t2
- The time you want to get the positive difference from- Returns:
- A new Duration object that is the absolute difference
-
lessThan
Returns true if the parameter is before the calling object in time- Parameters:
t2
- The second time to compare to- Returns:
- a boolean
-
greaterThan
Returns true if the parameter is after the calling object in time- Parameters:
t2
- The second time to compare to- Returns:
- a boolean
-
lessThanOrEqualTo
Returns true if the parameter is before the calling object in time or if they represent the same time- Parameters:
t2
- The second time to compare to- Returns:
- a boolean
-
greaterThanOrEqualTo
Returns true if the parameter is after the calling object in time or if they represent the same time- Parameters:
t2
- The second time to compare to- Returns:
- a boolean
-
min
Returns the earliest of a list of times. Wraps Collections.min()- Parameters:
times
- Time objects- Returns:
- A time object
-
max
Returns the latest of a list of times. Wraps Collections.max()- Parameters:
times
- Time objects- Returns:
- A time object
-
round
Rounds the time to the input resolution, based on the reference time. Uses midnight utc for reference time.- Parameters:
resolution
-- Returns:
-
round
Rounds the time to the input resolution, based on the reference time. For example, with a reference time of 2019-001T00:00:00 and resolution of 00:05:00 2019-001T00:33:00 would be rounded to 2019-001T00:35:00, but with a reference time of 2019-001T00:00:01 the same input time would be rounded to 2019-001T00:35:01.- Parameters:
resolution
-referenceTime
-- Returns:
-
ceil
Rounds the time up to the input resolution, based on the reference time. Uses midnight utc for reference time.- Parameters:
resolution
-- Returns:
-
ceil
Rounds the time up to the input resolution, based on the reference time. See explanation in round method for reference time.- Parameters:
resolution
-referenceTime
-- Returns:
-
floor
Rounds the time down to the input resolution, based on the reference time. Uses midnight utc for reference time.- Parameters:
resolution
-- Returns:
-
floor
Rounds the time down to the input resolution, based on the reference time. See explanation in round method for reference time.- Parameters:
resolution
-referenceTime
-- Returns:
-
equalToWithin
Compares the time to another time object and returns true if t2 is within an input resolution of t1.- Parameters:
t2
-resolution
-- Returns:
-
getMidnightUTC
- Returns:
- A Time object that equals midnight on the current day UTC
-
getTimeOfDay
- Returns:
- A duration representing the elapsed duration since midnight UTC for this Time
-
toString
Overrides the default toString() method so you get a default representation of the object. In this case, we are using UTC format with the default number of decimal places. To get other string methods, use toX() methods -
valueOf
Given a UTC time format (anything allowed by str2et), mutates the calling object to represent that time Implements the convertableFromString interface so engines can call valueOf on whatever object including Times.- Specified by:
valueOf
in interfaceConvertableFromString
- Parameters:
utcFormattedString
-
-
toUTC
Returns a utc string with the default precision.- Returns:
-
toUTC
Outputs a string representing a time with the given number of decimal precision- Parameters:
precision
- An integer, the number of decimal places put out by the function- Returns:
- A string representing the time in UTC DOY format
-
toTAI
public double toTAI()Outputs a double representing the time in SPICE TAI- Returns:
- A double, SPICE TAI of the instant of this object
-
fromTAI
Creates a Time object from Spice TAI seconds- Parameters:
TAI
- Spice TAI seconds- Returns:
- A new Time object
-
toET
public double toET()Converts the calling Time object to Spice ephemeris time- Returns:
- A double of the Spice ET equivalent to the calling object
-
fromET
Creates a Time object from Spice ET seconds- Parameters:
ephemerisTime
- Spice ET seconds- Returns:
- A new Time object
-
fromTDBString
Creates a time object from a time in the TDB (Spice ET) system formatted in ISOC- Parameters:
etString
- A time in TDB in ISOC. Example: 2027-04-30T02:17:09.8354- Returns:
- the equivalent Time object
-
toISOC
Outputs a string representing a time with the default number of decimal precision- Returns:
- A string representing the time in ISOC format
-
toISOC
Outputs a string representing a time with the given number of decimal precision- Parameters:
precision
- An integer, the number of decimal places put out by the function- Returns:
- A string representing the time in ISOC format
-
toJulian
Outputs a string representing a time with the default number of decimal precision- Returns:
- A string representing the time in Julian date format
-
toJulian
Outputs a string representing a time with the given number of decimal precision- Parameters:
precision
- An integer, the number of decimal places put out by the function- Returns:
- A string representing the time in Julian date format
-
toCalendar
Outputs a string representing a time with the default number of decimal precision- Returns:
- A string representing the time in UTC calendar format
-
toCalendar
Outputs a string representing a time with the given number of decimal precision- Parameters:
precision
- An integer, the number of decimal places put out by the function- Returns:
- A string representing the time in UTC calendar format
-
toUtcAmPm
Returns whether or not the UTC time is before noon as an AM_PM enum object.- Returns:
-
toSCLK
Outputs the SCLK string that is equivalent to the calling object. Uses Spice sce2s with the default spacecraft id- Returns:
- This time's SCLK string
-
toSCLK
Outputs the SCLK string that is equivalent to the calling object. Uses Spice sce2s- Parameters:
sc_id
- The NAIF ID of the spacecraft whose SCLK it is. This is typically a negative 3 digit number.- Returns:
- This time's SCLK string
-
fromSCLK
Returns a Time object that is equivalent to a given SCLK string. Uses default spacecraft id.- Parameters:
sclk_string
- The SCLK string itself - must be in a format that Spice scs2e can understand- Returns:
- A new Time object
-
fromSCLK
Returns a Time object that is equivalent to a given SCLK string- Parameters:
sclk_string
- The SCLK string itself - must be in a format that Spice scs2e can understandsc_id
- The NAIF ID of the spacecraft whose SCLK it is. This is typically a negative 3 digit number.- Returns:
- A new Time object
-
toSCLKD
public double toSCLKD()Outputs the SCLK decimal that is equivalent to the calling object. Uses sce2s then converts to a decimal. Automatically figures out the SCLK sub-second modulus by calling gdpool on the SCLK kernel. Uses default spacecraft id.- Returns:
- This time's SCLK decimal
-
toSCLKD
public double toSCLKD(int sc_id) Outputs the SCLK decimal that is equivalent to the calling object. Uses sce2s then converts to a decimal. Automatically figures out the SCLK sub-second modulus by calling gdpool on the SCLK kernel- Parameters:
sc_id
- The NAIF ID of the spacecraft whose SCLK it is. This is typically a negative 3 digit number.- Returns:
- This time's SCLK decimal
-
fromSCLKD
Creates a time object given a SCLK decimal. Uses default spacecraft id.- Parameters:
sclkd
- The SCLK decimal itself - a float number of seconds- Returns:
- A new Time object
-
fromSCLKD
Creates a time object given a SCLK decimal and a SC NAIF id- Parameters:
sclkd
- The SCLK decimal itself - a float number of secondssc_id
- The NAIF ID of the spacecraft whose SCLK it is. This is typically a negative 3 digit number.- Returns:
- A new Time object
-
fromTics
Creates a time object given the number of tics (NOT seconds). DO NOT use this to do your own time math, this is just for I/O- Parameters:
tics
- The number of 10-nanosecond tics since the reference time 2000-001T12:00:00 (not exactly).- Returns:
- A new Time object
-
toLMST
Wraps toLMST but uses default spacecraft id and precision- Returns:
- LMST string
-
toLMST
Wraps toLMST but uses default spacecraft id.- Parameters:
precision
- precision for output string- Returns:
- LMST string
-
toLMST
Outputs a string that represents this instant in Local Mean Solar Time (LMST) for the SC specified- Parameters:
sc_id
- The NAIF ID of the spacecraft. This is typically a negative 3 digit number. To get the separate LMST SCLK ID/landing site ID, this routine multiplies by -1 then appends '900', which is the NAIF unofficial standardprecision
- The number of decimal places that should be included in the output- Returns:
- The calling object represented as an LMST string
-
fromLMST
Returns a Time object equivalent to the input LMST string. Uses default spacecraft id.- Parameters:
lmst
- The LMST string - many different formats are accepted (the standard is Sol-####M##:##:##.###)- Returns:
- A new Time object
-
fromLMST
Returns a Time object equivalent to the input LMST string- Parameters:
lmst
- The LMST string - many different formats are accepted (the standard is Sol-####M##:##:##.###)sc_id
- The NAIF ID of the spacecraft. This is typically a negative 3 digit number. To get the separate LMST SCLK ID/landing site ID, this routine multiplies by -1 then appends '900', which is the NAIF unofficial standard- Returns:
- A new Time object
-
toLmstAmPm
Returns whether or not the LMST time is before noon as an AM_PM enum object. Uses default spacecraft id.- Returns:
-
toLmstAmPm
Returns whether or not the LMST time is before noon as an AM_PM enum object.- Parameters:
sc_id
-- Returns:
-
toSolNumber
public int toSolNumber()The integer sol number at the calling object Time. First calls toLMST() then uses regex to get the sol number. Uses default spacecraft id- Returns:
- An integer of the sol number at the Time queried
-
toSolNumber
public int toSolNumber(int sc_id) The integer sol number at the calling object Time. First calls toLMST() then uses regex to get the sol number.- Parameters:
sc_id
- The NAIF ID of the spacecraft. This is typically a negative 3 digit number. To get the separate LMST SCLK ID/landing site ID, this routine multiplies by -1 then appends '900', which is the NAIF unofficial standard- Returns:
- An integer of the sol number at the Time queried
-
toFractionalSols
public double toFractionalSols()The calling object Time expressed as a sol-fraction since the LMST epoch. For example, Sol-0026M12:00:00 is 26.5. First calls LMST() then converts HH:MM:SS to decimal. Uses default spacecraft id.- Returns:
- A double of the fractional sols elapsed since the LMST epoch
-
toFractionalSols
public double toFractionalSols(int sc_id) The calling object Time expressed as a sol-fraction since the LMST epoch. For example, Sol-0026M12:00:00 is 26.5. First calls LMST() then converts HH:MM:SS to decimal- Parameters:
sc_id
- The NAIF ID of the spacecraft. This is typically a negative 3 digit number. To get the separate LMST SCLK ID/landing site ID, this routine multiplies by -1 then appends '900', which is the NAIF unofficial standard- Returns:
- A double of the fractional sols elapsed since the LMST epoch
-
toLST
Wraps toLST but uses default spacecraft id, body id and frame.- Returns:
- LST duration (time of day)
-
toLST
Wraps toLST but uses default body id and frame.- Parameters:
sc_id
- naif id of spacecraft- Returns:
- LST duration (time of day)
-
toLST
Gets the local solar time at a SC's location given that body ID and body frame. This returns just a Duration between 0 and 24 hours, since with just this information and no epoch it is impossible to have a true time system. To get the hours, minutes, seconds from the resulting duration object, you can call .toHours(), toMinutes()%60, and toSeconds%60- Parameters:
sc_id
- The SC at whose position you want to know the local solar timebody_id
- The NAIF ID of the body that the spacecraft is on or orbitingbody_frame
- The NAIF frame string for the body the spacecraft is on or orbiting- Returns:
- A duration object between 0 and 24 hours in magnitude that contains the local solar time of the point on the given body
-
toLTST
Wraps toLTST but uses default spacecraft id, body id and body frame.- Returns:
- LTST string
-
toLTST
Wraps toLTST but uses default body id and frame.- Parameters:
sc_id
- naif spacecraft id- Returns:
- LTST string
-
toLTST
Calculates the LMST-assisted Local True Solar Time (LTST) value for the calling Time object. What this means is that this routine first calls toLST() to get the time of day, then infers the sol number from LMST (correcting if you need to add or subtract one sol over the midnight boundary). This means you have to have all the LMST kernels loaded to call this.- Parameters:
sc_id
- The SC at whose position you want to know the local true solar timebody_id
- The NAIF ID of the body that the spacecraft is on or orbitingbody_frame
- The NAIF frame string for the body the spacecraft is on or orbiting- Returns:
- The calling object represented as an LTST string
-
toTimezone
Returns a ZonedDateTime that is equivalent to the calling Time object. This is useful because ZonedDateTime has a lot of nice utility methods like DayOfWeek, getHours, etc etc that we don't have to wrap in this class- Parameters:
timezone
- The timezone string you want to convert the time into. It must be a string acceptable to the ZoneId.of() method- Returns:
- A ZonedDateTime object representing the same time in a different timezone
-
toTimezoneString
Wraps toTimezoneString but uses default precision.- Parameters:
timezone
- The timezone string you want to represent the instant in. It must be a string acceptable to the ZoneId.of() method- Returns:
- A string that contains the time in a different timezone
-
toTimezoneString
Returns a string representing the calling object instant moved to a different timezone- Parameters:
timezone
- The timezone string you want to represent the instant in. It must be a string acceptable to the ZoneId.of() methodprecision
- decimal precision to use for outputting the string- Returns:
- A string that contains the time in a different timezone
-
fromTimezoneString
Returns a new Time object given a local Time and the timezone that Time is in - converts to UTC, then feeds that String to standard Time constructor- Parameters:
timeString
- A local time, in the YYYY-DDDTHH:MM:SS.ssssss formattimezone
- The timezone string you want to convert the time into. It must be a string acceptable to the ZoneId.of() method- Returns:
- A new Time object
-
fromTimezone
Returns a new Time object given a Java ZonedDateTime - converts to UTC, then feeds that String to standard Time constructor- Parameters:
zdt
- The input ZonedDateTime- Returns:
- A new Time object
-
toGPSSeconds
public double toGPSSeconds()- Returns:
- A double of the GPS seconds equivalent to the calling object
-
fromGPSSeconds
- Returns:
- A Time equivalent to the input gps time as seconds
-
toGPS
- Returns:
- The time represented as a GPS string
-
fromGPS
- Parameters:
gpsString
- A time string in the GPS time system- Returns:
- A time object equivalent to the input string
-
toExcelUTC
- Returns:
- the Time represented as an excel-formatted UTC String with either 2 or 4 digit years
-
toExcelUTC
- Returns:
- the Time represented as an excel-formatted UTC String with a 2-digit year
-
fromExcelUTC
Turns excel-formatted UTC datetime string into Time object. Assumes any 2-digit years are 20xx- Parameters:
excelFormattedDate
- String in format mm/dd/yy hh:mm(:ss), an example is '02/21/19 18:45'- Returns:
-
getMilliseconds
For XMLTOL use only - in UTC seconds since 1970 since that is the spec- Returns:
- A string whose contents are milliseconds since Unix epoch
-
currentSystemTime
Return the current system time as a Time object.- Returns:
-
ETT2SCET
Returns the input earth transmit time + the upleg time to the spacecraft. Uses default spacecraft id.- Parameters:
ETT
- A Time object in ETT- Returns:
- A new Time object shifted by OWLT
-
ETT2SCET
Returns the input earth transmit time + the upleg time to the spacecraft.- Parameters:
ETT
- A Time object in ETTsc_id
- The NAIF id of the spacecraft for which you want the SpaceCraft Event Time- Returns:
- A new Time object shifted by OWLT
-
ETT2ERT
Returns the input earth transmit time + the upleg time to the spacecraft + the downleg time from the spacecraft when the signal arrives at the spacecraft. Uses default spacecraft id.- Parameters:
ETT
- A Time object in ETT- Returns:
- A new Time object shifted by RTLT
-
ETT2ERT
Returns the input earth transmit time + the upleg time to the spacecraft + the downleg time from the spacecraft when the signal arrives at the spacecraft.- Parameters:
ETT
- A Time object in ETTsc_id
- The NAIF id of the spacecraft that light is traveling to and from- Returns:
- A new Time object shifted by RTLT
-
ERT2ETT
Returns the input earth receive time - the downleg time from the spacecraft - the upleg time to the spacecraft when the signal was sent. Uses default spacecraft id- Parameters:
ERT
- A Time object in ERT- Returns:
- A new Time objected shifted by RTLT
-
ERT2ETT
Returns the input earth receive time - the downleg time from the spacecraft - the upleg time to the spacecraft when the signal was sent.- Parameters:
ERT
- A Time object in ERTsc_id
- The NAIF id of the spacecraft that light is traveling to and from- Returns:
- A new Time objected shifted by RTLT
-
SCET2ERT
Returns the input spacecraft event time + the downleg time from the spacecraft. Uses default spacecraft id and earth naif id.- Parameters:
SCET
- A Time object in SCET- Returns:
- A new Time object shifted by OWLT
-
SCET2ERT
Returns the input spacecraft event time + the downleg time from the spacecraft.- Parameters:
SCET
- A Time object in SCETsc_id
- The Naif id of the spacecraft that the SCET is tied to- Returns:
- A new Time object shifted by OWLT
-
SCET2ETT
Returns the input spacecraft time - the upleg time to the spacecraft. Uses default spacecraft id.- Parameters:
SCET
- A Time object in SCET- Returns:
- A new Time object shifted by OWLT
-
SCET2ETT
Returns the input spacecraft time - the upleg time to the spacecraft.- Parameters:
SCET
- A Time object in SCETsc_id
- The Naif id of the spacecraft that the SCET is tied to- Returns:
- A new Time object shifted by OWLT
-
ERT2SCET
Returns the input spacecraft event time - upleg time to the spacecraft. Uses default spacecraft id.- Parameters:
ERT
- A Time object in ERT- Returns:
- A new Time objected shifted by OWLT
-
ERT2SCET
Returns the input spacecraft event time - upleg time to the spacecraft.- Parameters:
ERT
- A Time object in ERTsc_id
- The NAIF id of the spacecraft for which you want the SpaceCraft Event Time- Returns:
- A new Time objected shifted by OWLT
-
upleg
Wraps upleg(t, sc_id, body_id), but always passes body_id = EARTH_NAIF_ID (Earth) Uses default spacecraft id- Parameters:
t
-- Returns:
-
upleg
Wraps upleg(t, sc_id, body_id), but always passes body_id = EARTH_NAIF_ID (Earth)- Parameters:
t
-sc_id
-- Returns:
-
upleg
Wraps upleg(t, sc_id, body_id, time_reference) but always passes in "SCET" as time reference- Parameters:
t
-sc_id
-body_id
-- Returns:
-
downleg
Wraps downleg(t, sc_id, body_id), but always passes body_id = EARTH_NAIF_ID (Earth) Uses default spacecraft id.- Parameters:
t
-- Returns:
-
downleg
Wraps downleg(t, sc_id, body_id), but always passes body_id = EARTH_NAIF_ID (Earth)- Parameters:
t
-sc_id
-- Returns:
-
downleg
Wraps downleg(t, sc_id, body_id, time_reference) but always passes in "SCET" as time reference- Parameters:
t
-sc_id
-body_id
-- Returns:
-
rtlt
Returns the RTLT as a duration object.- Returns:
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Time>
-
equals
-
hashCode
public int hashCode()
-