Class SntpClient


  • public class SntpClient
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      SntpClient()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long getNtpTime()
      Returns the time computed from the NTP transaction. * * @return time value computed from NTP server response.
      long getNtpTimeReference()
      Returns the reference clock value (value of SystemClock.elapsedRealtime()) * corresponding to the NTP time. * * @return reference clock corresponding to the NTP time.
      long getRoundTripTime()
      Returns the round trip time of the NTP transaction * * @return round trip time in milliseconds.
      boolean requestTime​(java.lang.String host, int timeout)
      Sends an SNTP request to the given host and processes the response. * * @param host host name of the server. * @param timeout network timeout in milliseconds. * @return true if the transaction was successful.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SntpClient

        public SntpClient()
    • Method Detail

      • requestTime

        public boolean requestTime​(java.lang.String host,
                                   int timeout)
        Sends an SNTP request to the given host and processes the response. * * @param host host name of the server. * @param timeout network timeout in milliseconds. * @return true if the transaction was successful.
      • getNtpTime

        public long getNtpTime()
        Returns the time computed from the NTP transaction. * * @return time value computed from NTP server response.
      • getNtpTimeReference

        public long getNtpTimeReference()
        Returns the reference clock value (value of SystemClock.elapsedRealtime()) * corresponding to the NTP time. * * @return reference clock corresponding to the NTP time.
      • getRoundTripTime

        public long getRoundTripTime()
        Returns the round trip time of the NTP transaction * * @return round trip time in milliseconds.