Synchronizing the time between client and server is pretty complex, I initially naively thought that using System.getCurrentTimeMillis() would somehow magically solve my problem. I realized quickly that this was not going to work as this is dependent on the current system time setting.
The most appropriate solution to the problem is to use a common NTP server and ensure that the time is set right, but this is rarely a viable option when you have to deal with consumer level apps. We have to therefore resort to re-implementing or approximating the time sync.
After searching through the web, this is the simplest one i could find and is what worked immediately and fixed our issues with time sync.
Based on the above equation, we are able to calculate the time difference between client and server time stamps and hence reduce the errors in physics calculations.
The most appropriate solution to the problem is to use a common NTP server and ensure that the time is set right, but this is rarely a viable option when you have to deal with consumer level apps. We have to therefore resort to re-implementing or approximating the time sync.
After searching through the web, this is the simplest one i could find and is what worked immediately and fixed our issues with time sync.
TimeSync Equations |
Comments