Class SntpMessage

java.lang.Object
org.drasyl.handler.sntp.SntpMessage

public abstract class SntpMessage extends Object
  • Field Details

  • Constructor Details

    • SntpMessage

      public SntpMessage()
  • Method Details

    • of

      public static SntpMessage of(int leapIndicator, int versionNumber, int mode, int stratum, int poll, int precision, float rootDelay, float rootDispersion, int referenceIdentifier, long referenceTimestamp, long originateTimestamp, long receiveTimestamp, long transmitTimestamp)
    • of

      public static SntpMessage of(long transmitTimestamp)
      Creates a client SntpMessage.
      Parameters:
      transmitTimestamp - the current timestamp in java format.
      Returns:
      a client SntpMessage.
    • getLeapIndicator

      public abstract int getLeapIndicator()
    • getVersionNumber

      public abstract int getVersionNumber()
    • getMode

      public abstract int getMode()
    • getStratum

      public abstract int getStratum()
    • getPoll

      public abstract int getPoll()
    • getPrecision

      public abstract int getPrecision()
    • getRootDelay

      public abstract float getRootDelay()
    • getRootDispersion

      public abstract float getRootDispersion()
    • getReferenceIdentifier

      public abstract int getReferenceIdentifier()
    • getReferenceTimestamp

      public abstract long getReferenceTimestamp()
    • getOriginateTimestamp

      public abstract long getOriginateTimestamp()
    • getReceiveTimestamp

      public abstract long getReceiveTimestamp()
    • getTransmitTimestamp

      public abstract long getTransmitTimestamp()
    • toNTPTime

      public static long toNTPTime(long javaTime)
      Converts javaTime to the correct NTP time format as defined in RFC-1305.
      Parameters:
      javaTime - the time in java format
      Returns:
      time in NTP format as defined in RFC-1305
    • toJavaTime

      public static long toJavaTime(long ntpTime)
      Converts ntpTime to the java time format.
      Parameters:
      ntpTime - time in format as defined in RFC-1305
      Returns:
      time in java format