Class EpochFormatter


  • public class EpochFormatter
    extends java.lang.Object
    Does string formatting of epoch values in various representations. The methods of this object are not in general thread-safe.
    Since:
    21 Jun 2013
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static long AD0_UNIX_MILLIS
      0 A.D.
      static boolean FAIL_ON_LEAP_ERROR
      Configures behaviour when a date is encountered which is known to have incorrectly applied leap seconds.
    • Constructor Summary

      Constructors 
      Constructor Description
      EpochFormatter()
      Constructs a formatter without leap second awareness.
      EpochFormatter​(int leapSecondLastUpdated)
      Constructs a formatter aware of the latest known leap second.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String formatEpoch​(double epoch)
      Formats a CDF EPOCH value as an ISO-8601 date.
      java.lang.String formatEpoch16​(double epoch1, double epoch2)
      Formats a CDF EPOCH16 value as an ISO-8601 date.
      java.lang.String formatTimeTt2000​(long timeTt2k)
      Formats a CDF TIME_TT2000 value as an ISO-8601 date.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • FAIL_ON_LEAP_ERROR

        public static boolean FAIL_ON_LEAP_ERROR
        Configures behaviour when a date is encountered which is known to have incorrectly applied leap seconds. If true, a RuntimeException is thrown, if false a log message is written.
      • AD0_UNIX_MILLIS

        public static final long AD0_UNIX_MILLIS
        0 A.D. in Unix milliseconds as used by EPOCH/EPOCH16 data types.
    • Constructor Detail

      • EpochFormatter

        public EpochFormatter()
        Constructs a formatter without leap second awareness.
      • EpochFormatter

        public EpochFormatter​(int leapSecondLastUpdated)
        Constructs a formatter aware of the latest known leap second.
        Parameters:
        leapSecondLastUpdated - value of GDR LeapSecondLastUpdated field (YYYYMMDD, or -1 for unused, or 0 for no leap seconds)
    • Method Detail

      • formatEpoch

        public java.lang.String formatEpoch​(double epoch)
        Formats a CDF EPOCH value as an ISO-8601 date.
        Parameters:
        epoch - EPOCH value
        Returns:
        date string
      • formatEpoch16

        public java.lang.String formatEpoch16​(double epoch1,
                                              double epoch2)
        Formats a CDF EPOCH16 value as an ISO-8601 date.
        Parameters:
        epoch1 - first element of EPOCH16 pair (seconds since 0AD)
        epoch2 - second element of EPOCH16 pair (additional picoseconds)
        Returns:
        date string
      • formatTimeTt2000

        public java.lang.String formatTimeTt2000​(long timeTt2k)
        Formats a CDF TIME_TT2000 value as an ISO-8601 date.
        Parameters:
        timeTt2k - TIME_TT2000 value
        Returns:
        date string