Package org.yamcs.utils
Class TimestampUtil
java.lang.Object
org.yamcs.utils.TimestampUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.protobuf.Timestamp
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)
-
Constructor Details
-
TimestampUtil
public TimestampUtil()
-
-
Method Details
-
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:
-