public class Tools extends Object
| Constructor and Description |
|---|
Tools() |
| Modifier and Type | Method and Description |
|---|---|
static Duration |
fromDcDuration(long dcNanos)
Converts EtherCat time interval, assumed to be the difference of two DC time values,
into a
Duration. |
static org.lsst.ccs.utilities.taitime.CCSTimeStamp |
fromDcInstant(long dcNanos)
Converts an EtherCAT Distributed Clock time value into
a CCS timestamp with millisecond precision.
|
static boolean |
getBoolean(ByteBuffer data)
Gets a PLC BOOL value from a byte buffer and converts it to a boolean value.
|
static void |
main(String[] args) |
static void |
putBoolean(ByteBuffer data,
boolean b)
Appends to a byte buffer the PLC BOOL value equivalent to a Java boolean.
|
static long |
toDcDuration(Duration interval)
Reverses the transformation performed by
toDcDuration(java.time.Duration). |
static long |
toDcInstant(org.lsst.ccs.utilities.taitime.CCSTimeStamp stamp)
Converts a CCS timestamp to a DC time value (count of nanoseconds) with
millisecond resolution.
|
public static boolean getBoolean(ByteBuffer data)
data - Holds the data.public static void putBoolean(ByteBuffer data, boolean b)
data - Holds the data.b - The boolean value to convert and append.public static org.lsst.ccs.utilities.taitime.CCSTimeStamp fromDcInstant(long dcNanos)
Assuming that the DC time is being kept in sync with a TAI or GPS time source then it's just a question of adjusting the epoch from that of DC time, 01-01-2000T00:00:00 UTC, to that of Unix, 01-01-1970T00:00:00 UTC. We do that by adding 946,684,813,000 milliseconds.
dcNanos - The DC time value measured in nanoseconds since 01-01-2000T00:00:00 UTC.CCSTimeStamp.currentTimeFromMillis().public static long toDcInstant(org.lsst.ccs.utilities.taitime.CCSTimeStamp stamp)
stamp - The CCS timestamp.fromDcInstant(long).public static Duration fromDcDuration(long dcNanos)
Duration.dcNanos - The DC time difference, a count of nanoseconds.Duration value.public static long toDcDuration(Duration interval)
toDcDuration(java.time.Duration).interval - The time interval to convert.public static void main(String[] args)
Copyright © 2020 LSST. All rights reserved.