Package org.yamcs.time
Class Instant
- java.lang.Object
-
- org.yamcs.time.Instant
-
- All Implemented Interfaces:
Comparable<Instant>
public class Instant extends Object implements Comparable<Instant>
Yamcs high resolution instant storing milliseconds since 1970-01-01T00:00:00 TAI (including leap seconds) and picoseconds.Most of the Yamcs classes use just the milliseconds.
-
-
Field Summary
Fields Modifier and Type Field Description static InstantINVALID_INSTANTstatic longMAX_INSTANTstatic longMIN_INSTANT
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Instant o)doubledeltaFrom(Instant t)Compute the distance in seconds between this instant and the given instant.booleanequals(Object obj)static Instantget(long millis)Returns a new instant with the given milliseconds and the picos 0static Instantget(long millis, long picos)Create a new instant given the number of milliseconds and the number of picosecondslonggetMillis()intgetPicos()inthashCode()Instantplus(double secs)Add the given number of seconds to this and return the resultInstantplus(Instant t)Add the given instant to this and return the result.StringtoString()
-
-
-
Field Detail
-
INVALID_INSTANT
public static final Instant INVALID_INSTANT
-
MIN_INSTANT
public static final long MIN_INSTANT
- See Also:
- Constant Field Values
-
MAX_INSTANT
public static final long MAX_INSTANT
- See Also:
- Constant Field Values
-
-
Method Detail
-
get
public static Instant get(long millis, long picos)
Create a new instant given the number of milliseconds and the number of picoseconds- Parameters:
millis-picos-- Returns:
-
get
public static Instant get(long millis)
Returns a new instant with the given milliseconds and the picos 0- Parameters:
millis-- Returns:
-
getMillis
public long getMillis()
-
getPicos
public int getPicos()
-
plus
public Instant plus(Instant t)
Add the given instant to this and return the result.- Parameters:
t-- Returns:
-
plus
public Instant plus(double secs)
Add the given number of seconds to this and return the result- Parameters:
secs-- Returns:
-
deltaFrom
public double deltaFrom(Instant t)
Compute the distance in seconds between this instant and the given instant.- Parameters:
t-- Returns:
-
compareTo
public int compareTo(Instant o)
- Specified by:
compareToin interfaceComparable<Instant>
-
-