I'm creating a live scores application for Rugy League. It shows scores in real-time as a match is taking place. In Rugby League the match clock can be paused at any point during the match (similar to Basketball).
I'm having trouble accurately syncing the time representation of a match in my app with the actual match time obtained from a live feed.
When a match is taking place I retrieve data from a live feed every 5 seconds. This feed contains up-to-date information like the match time, scores etc.
In my app, I start an internal match clock during a live match. The reason for this is to show time ticking to the user (00:01....00:02...00:03). This internal match clock keeps ticking but is updated every time I get new information from the live feed. The internal match clock can sometimes be ahead/behind the actual match time and in these cases it is corrected to reflect the actual match time.
The internal match clock jumps back and forth every now and then when in it has to correct itself based on the data from the live feed.
So the internal match clock can be inaccurate by roughly 10 seconds or even more depending on network failure or other factors.
My issue with this implementation is the inaccuracy of the internal match clock (in the app). Ideally it would "jump" less and be in sync with the live event.
So, if you've ever had to do something like this, the question is, how have you synced your app with live sporting events when time accuracy is an important factor?
Open to any techniques/concepts you can share.