Class UTCScale

java.lang.Object
org.orekit.time.UTCScale
All Implemented Interfaces:
TimeScale

public class UTCScale extends Object implements TimeScale
Coordinated Universal Time.

UTC is related to TAI using step adjustments from time to time according to IERS (International Earth Rotation Service) rules. Before 1972, these adjustments were piecewise linear offsets. Since 1972, these adjustments are piecewise constant offsets, which require introduction of leap seconds.

Leap seconds are always inserted as additional seconds at the last minute of the day, pushing the next day forward. Such minutes are therefore more than 60 seconds long. In theory, there may be seconds removal instead of seconds insertion, but up to now (2010) it has never been used. As an example, when a one second leap was introduced at the end of 2005, the UTC time sequence was 2005-12-31T23:59:59 UTC, followed by 2005-12-31T23:59:60 UTC, followed by 2006-01-01T00:00:00 UTC.

This is intended to be accessed thanks to TimeScales, so there is no public constructor.

Author:
Luc Maisonobe
See Also:
  • Method Details

    • getBaseOffsets

      public Collection<? extends OffsetModel> getBaseOffsets()
      Get the base offsets.
      Returns:
      base offsets (may lack the pre-1975 offsets)
      Since:
      12.0
    • getUTCTAIOffsets

      public List<UTCTAIOffset> getUTCTAIOffsets()
      Returns the UTC-TAI offsets underlying this UTC scale.

      Modifications to the returned list will not affect this UTC scale instance.

      Returns:
      new non-null modifiable list of UTC-TAI offsets time-sorted from earliest to latest
    • offsetFromTAI

      public TimeOffset offsetFromTAI(AbsoluteDate date)
      Get the offset to convert locations from TAIScale to instance.
      Specified by:
      offsetFromTAI in interface TimeScale
      Parameters:
      date - conversion date
      Returns:
      offset in seconds to add to a location in TAIScale time scale to get a location in instance time scale
      See Also:
    • offsetFromTAI

      public <T extends CalculusFieldElement<T>> T offsetFromTAI(FieldAbsoluteDate<T> date)
      Get the offset to convert locations from TAIScale to instance.
      Specified by:
      offsetFromTAI in interface TimeScale
      Type Parameters:
      T - type of the filed elements
      Parameters:
      date - conversion date
      Returns:
      offset in seconds to add to a location in TAIScale time scale to get a location in instance time scale
      See Also:
    • offsetToTAI

      public TimeOffset offsetToTAI(DateComponents date, TimeComponents time)
      Get the offset to convert locations from instance to TAIScale.
      Specified by:
      offsetToTAI in interface TimeScale
      Parameters:
      date - date location in the time scale
      time - time location in the time scale
      Returns:
      offset in seconds to add to a location in instance time scale to get a location in TAIScale time scale
      See Also:
    • getName

      public String getName()
      Get the name time scale.
      Specified by:
      getName in interface TimeScale
      Returns:
      name of the time scale
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getFirstKnownLeapSecond

      public AbsoluteDate getFirstKnownLeapSecond()
      Get the date of the first known leap second.
      Returns:
      date of the first known leap second
    • getLastKnownLeapSecond

      public AbsoluteDate getLastKnownLeapSecond()
      Get the date of the last known leap second.
      Returns:
      date of the last known leap second
    • insideLeap

      public boolean insideLeap(AbsoluteDate date)
      Check if date is within a leap second introduction in this time scale.

      This method will return false for all time scales that do not implement leap seconds, even if the date corresponds to a leap second in UTC scale.

      Specified by:
      insideLeap in interface TimeScale
      Parameters:
      date - date to check
      Returns:
      true if time is within a leap second introduction
    • insideLeap

      public <T extends CalculusFieldElement<T>> boolean insideLeap(FieldAbsoluteDate<T> date)
      Check if date is within a leap second introduction in this time scale.

      This method will return false for all time scales that do not implement leap seconds, even if the date corresponds to a leap second in UTC scale.

      Specified by:
      insideLeap in interface TimeScale
      Type Parameters:
      T - type of the filed elements
      Parameters:
      date - date to check
      Returns:
      true if time is within a leap second introduction
    • minuteDuration

      public int minuteDuration(AbsoluteDate date)
      Check length of the current minute in this time scale.

      This method will return 60 for all time scales that do not implement leap seconds, even if the date corresponds to a leap second in UTC scale, and 61 for time scales that do implement leap second when the current date is within the last minute before the leap, or during the leap itself.

      Specified by:
      minuteDuration in interface TimeScale
      Parameters:
      date - date to check
      Returns:
      60 or 61 depending on leap seconds introduction
    • minuteDuration

      public <T extends CalculusFieldElement<T>> int minuteDuration(FieldAbsoluteDate<T> date)
      Check length of the current minute in this time scale.

      This method will return 60 for all time scales that do not implement leap seconds, even if the date corresponds to a leap second in UTC scale, and 61 for time scales that do implement leap second when the current date is within the last minute before the leap, or during the leap itself.

      Specified by:
      minuteDuration in interface TimeScale
      Type Parameters:
      T - type of the filed elements
      Parameters:
      date - date to check
      Returns:
      60 or 61 depending on leap seconds introduction
    • getLeap

      public TimeOffset getLeap(AbsoluteDate date)
      Get the value of the previous leap.

      This method will return 0 for all time scales that do not implement leap seconds.

      Specified by:
      getLeap in interface TimeScale
      Parameters:
      date - date to check
      Returns:
      value of the previous leap
    • getLeap

      public <T extends CalculusFieldElement<T>> T getLeap(FieldAbsoluteDate<T> date)
      Get the value of the previous leap.

      This method will return 0.0 for all time scales that do not implement leap seconds.

      Specified by:
      getLeap in interface TimeScale
      Type Parameters:
      T - type of the filed elements
      Parameters:
      date - date to check
      Returns:
      value of the previous leap