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 Instant
INVALID_INSTANT
static long
MAX_INSTANT
static long
MIN_INSTANT
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Instant o)
double
deltaFrom(Instant t)
Compute the distance in seconds between this instant and the given instant.boolean
equals(Object obj)
static Instant
get(long millis)
Returns a new instant with the given milliseconds and the picos 0static Instant
get(long millis, long picos)
Create a new instant given the number of milliseconds and the number of picosecondslong
getMillis()
int
getPicos()
int
hashCode()
Instant
plus(double secs)
Add the given number of seconds to this and return the resultInstant
plus(Instant t)
Add the given instant to this and return the result.String
toString()
-
-
-
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:
compareTo
in interfaceComparable<Instant>
-
-