Retrieve Server Time
Device Information
Retrieve Server Time
Retrieve Server Time in milliseconds
Guide for Server Time Synchronization (Using EWMA)
To ensure accurate synchronization with the server time, follow these steps:
- Call the API endpoint /device/server-time multiple times and get server time in ms(epoch_ms). A higher number of requests improves accuracy but increases synchronization time. At least 10 times could be a good start.
- For each request, note the time when the request is sent (sent_at) and when the response is received (received_at).
- Calculate RTD (Round Trip Delay): RTD = received_at - sent_at.
- Adjust for network delay by adding half of RTD to the received server time: server_time_estimated = epoch_ms + RTD / 2
- Calculate the time difference between the server_time_estimated and the client’s current time (client_ts): time_diff = server_time_estimated - client_ts.
- Instead of a simple average, use Exponentially Weighted Moving Average (EWMA) to smooth out variations:
alpha = 0.3 # Smoothing factor, 0.1 to 0.3 (recommended for balancing stability and responsiveness).
ewma = alpha * time_diff + (1 - alpha) * ewma
- Use the EWMA-adjusted offset to compute the synchronized server time when sending data:
synchronized_server_time_ms = client_ts + ewma
- Use the synchronized server time to send data to the device in the corresponding API endpoints.
GET
Retrieve Server Time
Authorizations
Short-lived session token obtained from POST /api/sessions/v2.
Send it as Authorization: Bearer <session_token> together with the X-Device-Key: <device-key> header identifying the target device.
Headers
Device Key (4 BIP39 words) identifying the target device.
Obtain it from POST /device/otp/confirm/v2.
Pattern:
^[a-z]+-[a-z]+-[a-z]+-[a-z]+$Example:
"alpha-bravo-charlie-delta"
Response
200 - application/json
OK
The current server time in milliseconds.