@UnstableApi
class SntpClient


Static utility to retrieve the device time offset using SNTP.

Based on the Android framework SntpClient.

Summary

Nested types

Callback for calls to initialize.

Constants

const String!
DEFAULT_NTP_HOST = "time.android.com"

The default NTP host address used to retrieve getElapsedRealtimeOffsetMs.

Public functions

java-static Unit

Starts loading the device time offset.

Public properties

java-static Long
@GuardedBy(value = "valueLock")
elapsedRealtimeOffsetMs
java-static Boolean
@GuardedBy(value = "valueLock")
isInitialized
java-static String!
@GuardedBy(value = "valueLock")
ntpHost

Constants

DEFAULT_NTP_HOST

const val DEFAULT_NTP_HOST = "time.android.com": String!

The default NTP host address used to retrieve getElapsedRealtimeOffsetMs.

Public functions

initialize

java-static fun initialize(loader: Loader?, callback: SntpClient.InitializationCallback?): Unit

Starts loading the device time offset.

Parameters
loader: Loader?

A Loader to use for loading the time offset, or null to create a new one.

callback: SntpClient.InitializationCallback?

An optional InitializationCallback to be notified when the time offset has been initialized or initialization failed.

Public properties

elapsedRealtimeOffsetMs

@GuardedBy(value = "valueLock")
java-static val elapsedRealtimeOffsetMsLong

isInitialized

@GuardedBy(value = "valueLock")
java-static val isInitializedBoolean

ntpHost

@GuardedBy(value = "valueLock")
java-static var ntpHostString!