IT. Expert System.

Android Reference

SntpClient


android.net

Class SntpClient



  • public class SntpClient
    extends Object
    Simple SNTP client class for retrieving network time. Sample usage:
    SntpClient client = new SntpClient();
     if (client.requestTime("time.foo.com")) {
         long now = client.getNtpTime() + SystemClock.elapsedRealtime() - client.getNtpTimeReference();
     }
     
    • Constructor Detail

      • SntpClient

        public SntpClient()
    • Method Detail

      • requestTime

        public boolean requestTime(String host,
                          int timeout)
        Sends an SNTP request to the given host and processes the response.
        Parameters:
        host - host name of the server.
        timeout - network timeout in milliseconds.
        Returns:
        true if the transaction was successful.
      • getNtpTime

        public long getNtpTime()
        Returns the time computed from the NTP transaction.
        Returns:
        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.
        Returns:
        reference clock corresponding to the NTP time.
      • getRoundTripTime

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


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 282 / 158861555. Delta: 0.05722 с