I"ll simplify a scenario where there is a need for a countdown to release tickets, and you need to release the ticket button on time at zero.
the question is, how do you keep this zero in sync with the server?
at present, most searches on the Internet say that when a request is sent, the result of the request is server-side time.
write down a timestamp when you request, and a timestamp when you return the server time. The time difference between the two timestamps is network time , and server time + network time
is current server time .
however, there is a problem here, that is, the server time obtained is only available after the request is made, while the network time is too long, which includes the time consuming of request + response
.
how to achieve millisecond error?