Enum Class TimeScale

java.lang.Object
java.lang.Enum<TimeScale>
net.time4j.scale.TimeScale
All Implemented Interfaces:
Serializable, Comparable<TimeScale>, java.lang.constant.Constable

public enum TimeScale extends Enum<TimeScale>

Defines some time scales for usage both in civil life and in science.

Any conversion is usually not bijective. That means that for example an UTC-timestamp can be mapped in a unique way to UT1, GPS or TAI (provided that there are no negative leap seconds) but in reverse not. More important: Conversions often happen in millisecond-precision or worse so they are more or less like approximation procedures.

Author:
Meno Hochschild
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Is used by the GPS-navigation system and counts SI-seconds relative to the start of GPS.
    Counts the seconds relative to UNIX-epoch 1970-01-01T00:00:00Z which is two years before UTC-epoch.
    International atomic time which is based on the SI-seconds of an atomic clock and presents a continuous scale relative to 1958-01-01.
    The Terrestrial Time is not bound to the rotation of the earth and is a dynamic time derived from ephmerides (theoretical ideal).
    Mean solar time with variable seconds bound to the rotation of the earth.
    Counts the seconds relative to UTC-epoch which started at midnight on the calendar days 1972-01-01 (1972-01-01T00:00:00Z) inclusive all leap seconds.
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    deltaT​(int year, int month)
    Estimates the delta between TT and UT1 in decimal seconds depending on given year and month.
    static double
    Estimates the delta between TT and UT1 in decimal seconds depending on given date.
    static TimeScale
    valueOf​(String name)
    Returns the enum constant of this class with the specified name.
    static TimeScale[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Enum

    compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • POSIX

      public static final TimeScale POSIX

      Counts the seconds relative to UNIX-epoch 1970-01-01T00:00:00Z which is two years before UTC-epoch.

      Leap seconds are not counted but ignored according to POSIX-standard. Before the UTC-epoch 1972-01-01 the second is effectively defined as the 86400th part of mean solar day (UT1). After this UTC-epoch the POSIX-second is with the exception of leap second events equal to the SI-second based on atomic clocks, but in long term effectively similar to the UT1-second based on mean solar time.

      POSIX is more present in computer realms than UTC although there is no precision in calculation of SI-seconds (a bug of UNIX-specification). The definition of the reference timezone on zero meridian of Greenwich is the same as in UTC.

      During a leap second the transformation of POSIX-time to an UTC-timestamp is not defined. An old convention in the UNIX world tries to reset the clock by one second AFTER the leap second, so effectively mapping the leap second to the next day despite of its obvious written form as last second of current day (see also Wikipedia-page). The current description of POSIX-time explicitly states however that the relation between the current day time and the current POSIX-value is not specified and dependent on the implementation. Time4J maps the leap second to the current day as the last second. This corresponds to an UNIX-variation where a clock is reset at the begin of a leap second instead of at the end of a leap second.

    • UTC

      public static final TimeScale UTC

      Counts the seconds relative to UTC-epoch which started at midnight on the calendar days 1972-01-01 (1972-01-01T00:00:00Z) inclusive all leap seconds.

      Time4J handles all UniversalTime-timestamps before the UTC-epoch as mean solar time (UT). The second is therefore defined as the 86400th part of the mean solar day before 1972. After the UTC-epoch 1972-01-01 the second is always the SI-second based on atomic clocks.

      See Also:
      UniversalTime
    • TAI

      public static final TimeScale TAI

      International atomic time which is based on the SI-seconds of an atomic clock and presents a continuous scale relative to 1958-01-01.

      There is no second which is interpreted respective labelled as leap second. Hence this scale is decoupled from civil day and only useful in a scientific context. As consequence the astronomic day has no meaning on this scale.

      Strictly spoken, the scale definition of TAI is a statistical approximation to the definition of an SI-second because the average of around 250 atomic clocks worldwide is used. But the deviations are in picoseconds or smaller which is not in the focus of this API.

      Users need to be careful about the period between 1958 and 1972 because Time4J applies approximations here: First to note, the SI-second was introduced in year 1967 so we can just speak about atomic seconds before that date in an approximated way. Second, the nowadays used TAI-scale had got its name on a conference in year 1971, third to note, the TAI-ancestors were still directly synchronized with UT2 hence had still got a vague astronomical reference. At the calendar date 1972-01-01, the difference between TAI and UTC was defined as exactly 10 seconds (TAI = UTC + 10), plus the count of atomic seconds between 1958 and 1972. This difference is fixed for all timestamps in epoch seconds because both TAI and UTC counts in pure SI-seconds since 1972. But note: If TAI and UTC are resolved to an element-oriented notation (YYYY-MM-DD HH:MM:SS) then the difference between TAI and UTC increases with every inserted leap second because of the different labelling. A TAI day does not know leap seconds. In the year 2017 this difference between a TAI day and an UTC day has increased to 37 seconds.

    • GPS

      public static final TimeScale GPS

      Is used by the GPS-navigation system and counts SI-seconds relative to the start of GPS.

      GPS was introduced on 6th of January 1980. All earlier timestamps are not supported by Time4J. Between 1972 and 1980 there were 9 leap seconds therefore following relation holds leaving aside the different epoch reference: GPS + delta = UTC - 9 = TAI - 19 where delta stands for the POSIX-difference between 1972-01-01 and 1980-01-06.

      See Also:
      TAI
    • TT

      public static final TimeScale TT

      The Terrestrial Time is not bound to the rotation of the earth and is a dynamic time derived from ephmerides (theoretical ideal).

      This standard was redefined since 1991 taking into account the altitude of an atomic clock relative to the surface of the earth. The predecessors ET (Ephemeris Time) and TDT (Terrestrial Dynamic Time) are equivalent to TT with millisecond precision. Time4J uses the approximation formula TT = TDT = ET = TAI + 32,184 SI-seconds. See also: Wikipedia.

      Due to the uncertainty of estimating delta-T, this time scale is not supported before the year -2000. Keep also in mind that this scale is NOT always monotone for any time around the year 1972 or earlier. Users should handle this scale as approximation for those ancient times.

      See Also:
      TAI, deltaT(int, int)
    • UT

      public static final TimeScale UT

      Mean solar time with variable seconds bound to the rotation of the earth.

      UT is technically labelled as UT1 and often mixed up with UTC because leap seconds are rare events and hardly noticed in civil life. The deviation of UT relative to TT is called "delta-T" (difference TT - UT) and is regularly published by IERS. Time4J uses polynomial expressions for the estimation of delta-T. These expressions are based on the work of the Belgian astronomer Jean Meeus and allow the limited conversion between UT and the other scales not bound to the rotation of the earth.

      Due to the uncertainty of estimating delta-T, this time scale is not supported after the year +3000. Keep also in mind that this scale is NOT monotone, especially not after the start of year 1972. Users should generally handle this scale as approximation.

      See Also:
      UTC, deltaT(int, int)
  • Method Details

    • values

      public static TimeScale[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static TimeScale valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • deltaT

      public static double deltaT(int year, int month)

      Estimates the delta between TT and UT1 in decimal seconds depending on given year and month.

      The estimation is mainly based on a polynomial expression of the NASA.

      Parameters:
      year - gregorian/julian year from -2000 until +3000
      month - gregorian/julian month in range 1-12
      Returns:
      estimated difference deltaT = TT - UT in seconds
      Throws:
      IllegalArgumentException - if any parameter is out of range
      Since:
      3.33/4.28
    • deltaT

      public static double deltaT(GregorianDate date)

      Estimates the delta between TT and UT1 in decimal seconds depending on given date.

      The estimation is mainly based on a polynomial expression of the NASA.

      Parameters:
      date - gregorian date from year -2000 until year +3000
      Returns:
      estimated difference deltaT = TT - UT in seconds
      Throws:
      IllegalArgumentException - if the date is out of range
      Since:
      3.33/4.28