Package org.yamcs.utils
Class TimestampUtil
- java.lang.Object
-
- org.yamcs.utils.TimestampUtil
-
public class TimestampUtil extends Object
-
-
Constructor Summary
Constructors Constructor Description TimestampUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.google.protobuf.Timestamp
currentTimestamp()
static com.google.protobuf.Timestamp
java2Timestamp(long timeMillisec)
Converts java time in milliseconds to protobuf Timestampstatic long
timestamp2Java(com.google.protobuf.Timestamp ts)
Converts protobuf Timestamp into java time in milliseconds Note: this loses precision (nanoseconds to milliseconds)
-
-
-
Method Detail
-
currentTimestamp
public static com.google.protobuf.Timestamp currentTimestamp()
- Returns:
- current (now) protobuf timestamp
-
java2Timestamp
public static com.google.protobuf.Timestamp java2Timestamp(long timeMillisec)
Converts java time in milliseconds to protobuf Timestamp- Parameters:
timeMillisec
- java timestamp to be converted- Returns:
-
timestamp2Java
public static long timestamp2Java(com.google.protobuf.Timestamp ts)
Converts protobuf Timestamp into java time in milliseconds Note: this loses precision (nanoseconds to milliseconds)- Parameters:
ts
- protobuf timestamp to be converted- Returns:
-
-