1021 INVALID_TIMESTAMP - timestamp ahead of server time

Hi all,

I’ve sync’d my app with the server’s time using the timestamp from the exchangeInfo API endpoint.
Most of the time, this works fine. However, occassionally (maybe after thousands of requests, I occassionally get the 1021 INVALID_TIMESTAMP “Timestamp for this request was 1000ms ahead of the server’s time” ).

If my time has been sync’d when I first started up, how would this be possible ?
I can understand if I received the “timestamp for this request is outside of the recvWindow”, but I don’t understand how once sync’d my clock can drift that much ahead of the server time

Maybe that’s the problem? The server time you receive from the API has network latency not included into it. If network latency is 100ms then the server time you observe over API is 100ms behind the current server time. (Although in this case your clock would be behind server time, not ahead of it…)

Anyways, just use NTP or some other standard way to sync your clock, don’t use exchange time. I’ve never had issues with this using out-of-the box Fedora Linux installations, and my guess is that your attempt to sync ‘to exchange’ just made things worse.

Thanks for responding - I considered using NTP initially.
However, I thought the whole point of serverTime and /api/v3/time endpoint was for people to “offset” their clocks
I’ll give NTP a crack if you don’t have any issues using it. Many thanks