SntpClient
@UnstableApi
class SntpClient
Static utility to retrieve the device time offset using SNTP.
Based on the Android framework SntpClient.
Summary
Nested types |
|---|
interface SntpClient.InitializationCallbackCallback for calls to |
Constants |
|
|---|---|
const String! |
DEFAULT_NTP_HOST = "time.android.com"The default NTP host address used to retrieve |
const Int |
DEFAULT_TIMEOUT_MS = 1000The default maximum time, in milliseconds, to wait for the SNTP request to complete. |
Public functions |
|
|---|---|
java-static Unit |
initialize(loader: Loader?, callback: SntpClient.InitializationCallback?)Starts loading the device time offset. |
Public properties |
|
|---|---|
java-static Long |
@GuardedBy(value = "valueLock") |
java-static Boolean |
@GuardedBy(value = "valueLock") |
java-static Long |
@GuardedBy(value = "valueLock") |
java-static String! |
|
java-static Int |
Constants
DEFAULT_NTP_HOST
const val DEFAULT_NTP_HOST = "time.android.com": String!
The default NTP host address used to retrieve getElapsedRealtimeOffsetMs.
DEFAULT_TIMEOUT_MS
const val DEFAULT_TIMEOUT_MS = 1000: Int
The default maximum time, in milliseconds, to wait for the SNTP request to complete.
Public functions
initialize
java-static fun initialize(loader: Loader?, callback: SntpClient.InitializationCallback?): Unit
Starts loading the device time offset.
| Parameters | |
|---|---|
loader: Loader? |
A |
callback: SntpClient.InitializationCallback? |
An optional |
Public properties
elapsedRealtimeOffsetMs
@GuardedBy(value = "valueLock")
java-static val elapsedRealtimeOffsetMs: Long
maxElapsedTimeUntilUpdateMs
@GuardedBy(value = "valueLock")
java-static var maxElapsedTimeUntilUpdateMs: Long