Class TAITime

java.lang.Object
csw.time.core.models.TAITime
All Implemented Interfaces:
TMTTime, Serializable, scala.Equals, scala.Product

public final class TAITime extends Object implements TMTTime, scala.Product, Serializable
Represents an instantaneous point in International Atomic Time (TAI).

param: value the underlying java.time.Instant

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static TAITime
    after(scala.concurrent.duration.FiniteDuration duration)
     
    static TAITime
    now()
    Obtains the PTP (Precision Time Protocol) synchronized current time in TAI timescale.
    static int
    Fetches UTC to TAI offset by doing a native call to ntp_gettimex in case of a Linux machine.
    Converts the TAITime to UTCTime by subtracting the UTC-TAI offset.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface scala.Equals

    canEqual, equals

    Methods inherited from interface scala.Product

    productArity, productElement, productElementName, productElementNames, productIterator, productPrefix

    Methods inherited from interface csw.time.core.models.TMTTime

    currentInstant, durationFromNow
  • Constructor Details

    • TAITime

      public TAITime(Instant value)
  • Method Details

    • now

      public static TAITime now()
      Obtains the PTP (Precision Time Protocol) synchronized current time in TAI timescale. In case of a Linux machine, this will make a native call clock_gettime inorder to get time from the system clock with nanosecond precision In case of all the other operating systems, nanosecond precision is not supported, hence no native call is made.

      Returns:
      current time in TAI scale
    • after

      public static TAITime after(scala.concurrent.duration.FiniteDuration duration)
    • offset

      public static int offset()
      Fetches UTC to TAI offset by doing a native call to ntp_gettimex in case of a Linux machine. It ensures to get the latest offset as updated by the PTP Grandmaster.

      Returns:
      offset of UTC to TAI in seconds
    • value

      public Instant value()
      Specified by:
      value in interface TMTTime
    • toUTC

      public UTCTime toUTC()
      Converts the TAITime to UTCTime by subtracting the UTC-TAI offset. UTC-TAI offset is fetched by doing a native call to ntp_gettimex. It ensures to get the latest offset as updated by the PTP Grandmaster.

      Returns:
      UTC time at the given TAI time