Is there any problem that Python time.time() is later than server time?

Asked 1 years ago, Updated 1 years ago, 67 views

I'm going to use API for the first time You are about to import data from a cryptocurrency exchange.

If you look at the API document, the explanation and logic related to time are as follows.

timestamp, to be sent which should be the millisecond timestamp of when the request was created and sent.

if (timestamp < serverTime && (serverTime - timestamp) <= recvWindow) {
// // process request
} } else {
// // reject request
}

If you look at the previous conditions, it is timestamp < server time, so I think I am checking if my computer time that sent the request is ahead of the server time.

But the time.time() confirmed the removal time, If you check the server time during the API and compare the received server time value, On the contrary, I can see that my computer time is longer.

I wonder if this is a problem, and if there is a problem, what should I do?

python api time timestamp server-time

2022-09-22 16:19

1 Answers

If you create and send a timestamp at the time of request, the recipient (server) will have to pay for the network time, so the server time must be greater than the time stamp for normal requests.

In addition, it seems that the valid time to correct the variable in recvWindow is compared in milliseconds because it should not be too different.


2022-09-22 16:19

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.