Package org.yamcs.sle
Class CcsdsTime
java.lang.Object
org.yamcs.sle.CcsdsTime
- All Implemented Interfaces:
Comparable<CcsdsTime>
CCSDS time storing the number of days since 1958 and the number of picoseconds in the day
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintstatic CcsdsTimefromCcsds(byte[] ds) P-field is implicit (not present, defaulted to 41 hex)static CcsdsTimefromCcsdsPico(byte[] ds) P-field is implicit (not present, defaulted to 42 hex)static CcsdsTimefromJavaMillis(long javaTime) Converts a java time in millisecondsstatic CcsdsTimefromJavaMillisPicos(long javaTime, int picos) Converts a java time in millisecondsstatic CcsdsTimefromSle(ConditionalTime time) static CcsdsTimeGets the time from the SLE time classstatic CcsdsTimefromUnix(long unixSeconds, int nanosec) Converts a UNIX time in seconds since 1970, nanoseconds in second (such as returned by gettitmeofday)byte[]P-field is implicit (not present, defaulted to 41 hex)byte[]T-field: 2 octets: number of days since 1958/01/01 00:00:00 4 octets: number of milliseconds of the day 4 octets: number of picoseconds of the millisecond (set to 0 if not used)intlongstatic CcsdsTimenow()Gets the current timelongConverts to java milliseconds.toSle(int sleVersion) static Timestatic ConditionalTimetoSleConditional(CcsdsTime time, int sleVersion) toString()Formats the time with up to nanosecond resolutionConverts to ISO8860 string with 12 digits picoseconds after dot
-
Field Details
-
SEC_IN_DAY
public static final int SEC_IN_DAY- See Also:
-
MS_IN_DAY
public static final int MS_IN_DAY- See Also:
-
-
Constructor Details
-
CcsdsTime
public CcsdsTime(int numDays, long picosecInDay)
-
-
Method Details
-
fromCcsds
P-field is implicit (not present, defaulted to 41 hex)T-field:
- 2 octets: number of days since 1958/01/01 00:00:00
- 4 octets: number of milliseconds of the day
- 2 octets: number of microseconds of the millisecond (set to 0 if not used)
- Parameters:
ds-- Returns:
-
fromCcsdsPico
P-field is implicit (not present, defaulted to 42 hex)T-field:
- 2 octets: number of days since 1958/01/01 00:00:00
- 4 octets: number of milliseconds of the day
- 4 octets: number of picoseconds of the millisecond (set to 0 if not used)
- Parameters:
ds-- Returns:
-
now
Gets the current time- Returns:
- the current time
-
fromJavaMillis
Converts a java time in milliseconds- Parameters:
javaTime-- Returns:
-
fromJavaMillisPicos
Converts a java time in milliseconds- Parameters:
javaTime-- Returns:
-
fromUnix
Converts a UNIX time in seconds since 1970, nanoseconds in second (such as returned by gettitmeofday)- Parameters:
unixSeconds- seconds since 1-Jan-1970 00:00:00 (without leap seconds)nanosec- nanoseconds in second- Returns:
-
getDaySegmented
public byte[] getDaySegmented()P-field is implicit (not present, defaulted to 41 hex)T-field:
- 2 octets: number of days since 1958/01/01 00:00:00
- 4 octets: number of milliseconds of the day
- 2 octets: number of microseconds of the millisecond (set to 0 if not used)
-
getDaySegmentedPico
public byte[] getDaySegmentedPico()T-field:
- 2 octets: number of days since 1958/01/01 00:00:00
- 4 octets: number of milliseconds of the day
- 4 octets: number of picoseconds of the millisecond (set to 0 if not used)
-
getPicosecInDay
public long getPicosecInDay() -
getNumDays
public int getNumDays() -
toSle
-
fromSle
Gets the time from the SLE time class- Parameters:
time-- Returns:
-
fromSle
-
toSle
-
toSleConditional
-
toJavaMillisec
public long toJavaMillisec()Converts to java milliseconds. Note: this loses precision.- Returns:
- the java milliseconds since 1970.
-
compareTo
- Specified by:
compareToin interfaceComparable<CcsdsTime>
-
toString
Formats the time with up to nanosecond resolution -
toStringPico
Converts to ISO8860 string with 12 digits picoseconds after dot- Returns:
-