public class XTCEPosixTimeHandler extends Object implements XTCEAbsoluteTimeType
This class is applicable to AbsoluteTimeType XTCE specifications when three conditions are met by the XML document:
The EU/Calibrated value is implemented to be a UTC string, with no leap second correction. It is based on the internal system clock of this host. The Uncalibrated value is the microseconds since midnight 1970-01-01 date. The raw value is two POSIX unsigned integers, 32 bits of seconds, followed by 32 bits of microseconds. The BitSet of the raw encoded value will be equal to that of a "struct timeval" in the C programming language foundation of many computing platforms.
Although the POSIX specification carries microseconds, the Java implementation here uses the basic libraries and will only act as far as the milliseconds.
| Constructor and Description |
|---|
XTCEPosixTimeHandler()
Default constructor to initialize a handler with the default time
format and time zone.
|
XTCEPosixTimeHandler(String timeFormat,
String timeZone)
Constructor that permits changing the default time format and the
time zone information.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getCalibratedFromUncalibrated(String uncalValue)
Retrieve the EU calibrated value of this time item, which can be a
Parameter or Argument, when given the uncalibrated value.
|
BitSet |
getRawFromUncalibrated(String uncalValue)
Retrieve the raw binary bits for encoding of this time item, which can
be a Parameter or Argument, when given the uncalibrated value.
|
String |
getUncalibratedFromCalibrated(String euValue)
Retrieve the uncalibrated value for this time item, which can be a
Parameter or Argument, when given the EU calibrated value.
|
String |
getUncalibratedFromRaw(BitSet rawValue)
Retrieve the uncalibrated value of this time item, which can be a
Parameter or Argument, when given the raw binary value.
|
boolean |
isApplicable(org.omg.space.xtce.AbsoluteTimeDataType instance)
Method to determine if an XTCE AbsoluteTimeType, either Parameter or
Argument, is handled by this implementation of the interface.
|
public XTCEPosixTimeHandler()
The default time output format is UTC ISO8601 text. This is in the form of YYYY-MM-dd HH:MM:ss.SSS
public XTCEPosixTimeHandler(String timeFormat, String timeZone)
timeFormat - String containing the time format string suitable
for the Java SimpleDateFormat formatter.timeZone - String containing the time zone identifier string,
suitable for the TimeZone.getTimeZone method in Java.public boolean isApplicable(org.omg.space.xtce.AbsoluteTimeDataType instance)
This method returns true when three conditions are met by the XML that is represented by the JAXB AbsoluteTimeDataType object instance passed by the caller:
isApplicable in interface XTCEAbsoluteTimeTypeinstance - AbsoluteTimeDataType object from the JAXB representation
of the XTCE XML document.public String getUncalibratedFromRaw(BitSet rawValue)
The raw input value is a BitSet of 64 bits in the form of two 32 bit unsigned integers. The first is the number of seconds since the UNIX epoch of 1970-01-01 and the seconds in the number of microseconds within the second. The output String will be an integral representation of the number of microseconds since 1970-01-01.
This conversion uses only system time capabilities, and as a result is not leap second corrected.
getUncalibratedFromRaw in interface XTCEAbsoluteTimeTyperawValue - BitSet containing the raw binary value that would
be encoded on the wire or bitfield. The raw binary is always expected
to be in the order read from the stream.public String getCalibratedFromUncalibrated(String uncalValue)
The uncalibrated input string contains an integral number of microseconds since the UNIX epoch. The output string is the UTC string in the form of ISO8601 (YYYY-MM-DD HH:MM:SS.sssss). The timezone is always UTC/GMT.
getCalibratedFromUncalibrated in interface XTCEAbsoluteTimeTypeuncalValue - String containing the uncalibrated value that is
derived from the encoded value on the wire or bitfield.NumberFormatException - in the event that the uncalibrated value
cannot be converted to an integral number.public BitSet getRawFromUncalibrated(String uncalValue)
The raw output value is a BitSet of 64 bits in the form of two 32 bit unsigned integers. The first is the number of seconds since the UNIX epoch of 1970-01-01 and the seconds in the number of microseconds within the second. The input String will be an integral representation of the number of microseconds since 1970-01-01.
This conversion uses only system time capabilities, and as a result is not leap second corrected.
getRawFromUncalibrated in interface XTCEAbsoluteTimeTypeuncalValue - String containing the uncalibrated representation of
the value.NumberFormatException - in the event that the uncalibrated value
cannot be converted to an integral number.public String getUncalibratedFromCalibrated(String euValue)
The uncalibrated output string contains an integral number of microseconds since the UNIX epoch. The input string is the UTC string in the form of ISO8601 (YYYY-MM-DD HH:MM:SS.sssss).
getUncalibratedFromCalibrated in interface XTCEAbsoluteTimeTypeeuValue - String containing a value of this item represented in
EU/calibrated form.RuntimeException - in the event that a checked exception is caught
by this function, with the parsing error text copied.Copyright © 2015–2019. All rights reserved.