HTTP Time Synchronization API
POST/v1/time
This method provides a simple HTTPS based time Synchronization API. The API will return the time synchronization information which can be used to correct system time of device. It does not provide accuracy as high as NTP protocol but it is much simpler to implement. If your application does not demand millisecond accurate time measurement, you can use this API to achieve time synchronization with accuracy of +/- 200 ms with respect to Anedya's Time Servers. This API can be used as following:
- First Device needs to measure current time as per internal system clock and convert it to Unix millisecond timestamp.
- Device sends this timestamp in a HTTPS POST request with minimal processing delay
- The server responds with three parameters: Device Send Time, Server Receive Time and Server Send Time. At the same time device also records the timestamp at which the response is received.
- The exact current time can be calculated by using following equation:
current_time = (Server Receive Time + Server Send Time + Device Recieve Time - Device Send Time)/2
MQTT Topic
$anedya/device/{deviceid}/time/json
Request
- application/json
Body
deviceSendTime integer
Device Send Time as per the system clock of the device
Responses
- 200
API returns the response with Time Synchronization information which can be used to correct system of device
- application/json
- Schema
- Example (from schema)
Schema
deviceSendTime integer
Device Send Time
serverReceiveTime integer
Server Receive Time
serverSendTime integer
Server Send Time
{
"deviceSendTime": 0,
"serverReceiveTime": 0,
"serverSendTime": 0
}
Loading...