Class HighPrecisionDateTimeFormatters

java.lang.Object
com.epam.fix.message.HighPrecisionDateTimeFormatters

public class HighPrecisionDateTimeFormatters extends Object
Helper class for FIX date and time formats.

Provides ability for formatting different types of date/time values to the buffer of bytes. It is also possible to work with high precision values: micro- and nanoseconds.

Author:
Liubov_Efremova
  • Method Details

    • formatTimeOnly

      public static void formatTimeOnly(byte[] buffer, LocalTime time, TimestampPrecision precision)
      Formats the value of local time to the UTCTimeOnly format.

      The format for UTCTimeOnly is HH:MM:SS[.sss][sss][sss].

      Parameters:
      buffer - the buffer of bytes to keep the UTCTimeOnly format
      time - the given time value
      precision - the desired time precision
      Throws:
      IllegalArgumentException
    • formatTimeOnly

      public static void formatTimeOnly(byte[] buffer, LocalTime time, TimestampPrecision precision, int offset)
      Formats the value of local time to the UTCTimeOnly format.

      The format for UTCTimeOnly is HH:MM:SS[.sss][sss][sss].

      Parameters:
      buffer - the buffer of bytes to keep the UTCTimeOnly format
      time - the given time value
      precision - the desired time precision
      offset - the offset
      Throws:
      IllegalArgumentException
    • formatTZTimeOnly

      public static void formatTZTimeOnly(byte[] buffer, OffsetTime time, TimestampPrecision precision)
      Formats the value of offset time to the TZTimeOnly format.

      The format for TZTimeOnly is HH:MM[:SS][.sss][sss][sss][Z | [ + | - hh[:mm]]].

      Parameters:
      buffer - the buffer of bytes to keep the UTCTimeOnly format
      time - the given time value
      precision - the desired time precision
    • formatTZTimeOnly

      public static void formatTZTimeOnly(byte[] buffer, OffsetTime time, TimestampPrecision precision, int offset)
      Formats the value of offset time to the TZTimeOnly format.

      The format for TZTimeOnly is HH:MM[:SS][.sss][sss][sss][Z | [ + | - hh[:mm]]].

      Parameters:
      buffer - the buffer of bytes to keep the UTCTimeOnly format
      time - the given time value
      precision - the desired time precision
      offset - the offset
    • formatTimestamp

      public static void formatTimestamp(byte[] buffer, LocalDateTime dateTime, TimestampPrecision precision)
      Formats the value of dateTime to Timestamp format.

      The format of Timestamp is YYYYMMDD-HH:MM:SS[.sss][sss][sss].

      Parameters:
      buffer - the buffer of bytes to keep the Timestamp format
      dateTime - the given date time value
      precision - the desired timestamp precision
      Throws:
      IllegalArgumentException
    • formatTimestamp

      public static void formatTimestamp(byte[] buffer, LocalDateTime dateTime, TimestampPrecision precision, int offset)
      Formats the value of dateTime to Timestamp format.

      The format of Timestamp is YYYYMMDD-HH:MM:SS[.sss][sss][sss].

      Parameters:
      buffer - the buffer of bytes to keep the Timestamp format
      dateTime - the given date time value
      precision - the desired timestamp precision
      offset - the offset
      Throws:
      IllegalArgumentException
    • formatTZTimestamp

      public static void formatTZTimestamp(byte[] buffer, OffsetDateTime dateTime, TimestampPrecision precision)
      Formats the value of offset date time to the TZTimestamp format.

      The format for TZTimestamp is YYYYMMDD-HH:MM[:SS][.sss][sss][sss][Z | [ + | - hh[:mm]]].

      Parameters:
      buffer - the buffer of bytes to keep the TZTimestamp format
      dateTime - the given date time value
      precision - the desired timestamp precision
    • formatTZTimestamp

      public static void formatTZTimestamp(byte[] buffer, OffsetDateTime dateTime, TimestampPrecision precision, int offset)
      Formats the value of offset date time to the TZTimestamp format.

      The format for TZTimestamp is YYYYMMDD-HH:MM[:SS][.sss][sss][sss][Z | [ + | - hh[:mm]]].

      Parameters:
      buffer - the buffer of bytes to keep the TZTimestamp format
      dateTime - the given date time value
      precision - the desired timestamp precision
      offset - the offset
    • formatStorageTimestamp

      public static void formatStorageTimestamp(byte[] buffer, int offset, OffsetDateTime dateTime, TimestampPrecision precision)
      Formats the value of dateTime to Storage Timestamp format.

      The format of Storage Timestamp is "YYYYMMDD HH:MM:SS.sss[sss][sss] - ".

      Parameters:
      buffer - the buffer of bytes to keep the Storage Timestamp format
      offset - the offset
      dateTime - the given date time value
      precision - the desired timestamp precision
      Throws:
      IllegalArgumentException