Itβs just from the head, without a code.
- Place the code on the server and client to send and receive ping.
- Send ping from client to server every time the client connects.
- Record the current time as the time of sending.
- When a client receives ping, write down the current time at the time of reception.
- Get the time delay by subtracting the reception time from the sending time and dividing by 2.
- The server sends the current time to the client.
- Subtract the time difference from the sent time server.
- Set the client time to the time from step 6.
I'm not sure this will work 100% accurate, but I hope this helps!
source share