Package uk.ac.bristol.star.cdf
Class EpochFormatter
java.lang.Object
uk.ac.bristol.star.cdf.EpochFormatter
Does string formatting of epoch values in various representations.
The methods of this object are thread-safe.
- Since:
- 21 Jun 2013
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic 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
ConstructorsConstructorDescriptionConstructs a formatter without leap second awareness.EpochFormatter
(int leapSecondLastUpdated) Constructs a formatter aware of the latest known leap second. -
Method Summary
Modifier and TypeMethodDescriptionformatEpoch
(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.
-
Field Details
-
FAIL_ON_LEAP_ERROR
public static boolean FAIL_ON_LEAP_ERRORConfigures 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_MILLIS0 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
Formats a CDF EPOCH value as an ISO-8601 date.- Parameters:
epoch
- EPOCH value- Returns:
- date string
-
formatEpoch16
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
Formats a CDF TIME_TT2000 value as an ISO-8601 date.- Parameters:
timeTt2k
- TIME_TT2000 value- Returns:
- date string
-