Synchronize clocks
Lattice checks the timestamps on every entity you publish against its own clock. If the clock on your client drifts, Lattice can reject your entities or ignore your updates. Often there is no error. A common symptom is an integration that works from one computer but not from another.
How Lattice checks time
Lattice applies three rules to each published entity:
expiry_timemust be later than the current Lattice time.provenance.source_update_timemust be no more than 10 minutes ahead of the current Lattice time.PublishEntityapplies an update to an existing entity only if itssource_update_timeis later than the stored value.
Most integrations set both timestamps from the local clock.
For example, an integration might set expiry_time to 10 seconds after the current time.
If that client’s clock is more than 10 seconds behind, every publish fails.
What happens when clocks drift
The following results come from tests against Lattice with a client clock set ahead or behind.
The error message names the field that failed and includes the current Lattice time:
expiry_time <time> must be after the present time <time>provenance.source_update_time must be a valid timestamp or no greater than 10m0s later than <time>
REST responses use camelCase field names, such as expiryTime.
A client clock that runs ahead also affects other publishers.
After it publishes an entity, PublishEntity ignores updates to that entity from clients with correct clocks.
This lasts until real time catches up with the future source_update_time.
PublishEntities doesn’t report rejected entities.
The stream closes with success even when Lattice drops every entity.
To see validation errors while you debug, publish with PublishEntity instead.
Check your clock offset
Lattice responses include a Date header with the current Lattice time, to the second.
Compare it with your local clock:
The request doesn’t need to succeed.
Error responses, such as 401 or 404, still include the Date header.
If the two times differ by more than a few seconds, fix the client clock before you debug anything else.
Keep clocks in sync
- Run a time synchronization service, such as an NTP client, on every computer that publishes entities.
- On a disconnected network, use a time source on the same network as Lattice.
- Log the error message from every failed publish. The message includes the Lattice time, which shows the offset.
- When your integration starts, compare the local time with the
Dateheader and warn if they differ.
What’s next
- Learn how to create an asset and set its timestamps.
- Review Retry connections to decide which errors to retry.