When you do a private request to Binance, the message is signed to increase the security of requests. The message takes the local time and sends inside the signed message, if the local time has a difference greater than 5 seconds with Binance servers, the request will be rejected. So, it's important to verify that your local time is synchronized, you can do this using the synchronization time method for your OS.
The logic is as follows:
if (timestamp < (serverTime + 1000) && (serverTime - timestamp) <= recvWindow) {
// process request
} else {
// reject request
}
It is recommended to use a small recvWindow of 5000 or less! The max cannot go beyond 60000 milliseconds.
You can check the Binance server time, calling method GetServerTime, which will return the time of the Binance server
The RecvWindow defaults to 5000, this value can be increased using the property REST_API.BinanceOptions.RecvWindow.
If your application cannot guarantee the local clock stays synchronized, for example a headless server with no reliable time service, you can let the component correct for the drift instead of having every private request rejected. Set REST_API.BinanceOptions.UseServerTimeOffset to True (by default False) and call the new SyncServerTime method whenever you want to measure the difference between the Binance server clock and your local clock, for example once at startup or on a schedule of your own choosing. SyncServerTime calls GetServerTime, compares it against the local clock, and stores the difference. From then on, every signed request's timestamp includes that stored offset.
The measured difference is available through the read only property ServerTimeOffset, in milliseconds, positive when the Binance server clock is ahead of your local clock. Nothing is measured or applied automatically, SyncServerTime must be called explicitly and UseServerTimeOffset must be enabled, so a signed request is only ever adjusted when the application asks for it.