Class EpochFormatter

java.lang.Object
uk.ac.bristol.star.cdf.EpochFormatter

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

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

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

    Modifier and Type
    Method
    Description
    formatEpoch(double epoch)
    Formats a CDF EPOCH value as an ISO-8601 date.
    formatEpoch16(double epoch1, double epoch2)
    Formats a CDF EPOCH16 value as an ISO-8601 date.
    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 Details

    • 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 Details

    • 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 Details

    • formatEpoch

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

      public 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 String formatTimeTt2000(long timeTt2k)
      Formats a CDF TIME_TT2000 value as an ISO-8601 date.
      Parameters:
      timeTt2k - TIME_TT2000 value
      Returns:
      date string