0

So I'm dealing with the need for highly accurate, synced times between devices. However, the user might move. I know the phone changes timezones automatically via cell tower. But how/how often does it pull the time?

I'm going to be using NTP protocol to calculate offsets, but it will be an issue if that offset is wrong. For example the app tells the phone to run instruction one at 9pm and calculates the offset so it will go off in sync with another device. An hour later the phone has moved say, 30 miles and thus is in contact with another tower and is about to fire off another instruction.

Will that NTP offset then be wrong because the phone got a slightly different time from a different tower because it pulls the time every time it connects to a new tower? Does it only pull time from the closest tower every arbitrary interval (i.e. 24 hours) unless there's a timezone change? I don't want to be making continual unnecessary NTP calls (e.g. every minute) since the app is cycle intensive and only want to make sure the offset is correct by triggering whenever the device time gets changed.

Kurt Wagner
  • 3,295
  • 13
  • 44
  • 71
  • 1
    Bear in mind that depending on where you are and your device, you might be getting NITZ time signals rather than using NTP. Beyond that, I'll be somewhat surprised if the behavior that you are interested in is documented, and it may well vary by Android release, etc. – CommonsWare Jul 30 '14 at 23:16
  • I would probably go the route of having a central server that sends out push notifications at the correct time. Then you take out the variable of the device's currently set time. – Kevin Coppock Jul 30 '14 at 23:17
  • Check out this question http://stackoverflow.com/questions/8210264/sync-android-devices-via-gps-time. It discusses using GPS time as a super-accurate clock. I think that's the only way you're going to get the accuracy you need. – Chris Thompson Jul 30 '14 at 23:21
  • @ChrisThompson How accurate is it really though, I read http://stackoverflow.com/questions/11190843/sync-time-for-recording-data-on-multiple-android-devices before posting this which seems to suggest GPS isn't that reliable (although it may have gotten better since Android 2.2?) Also, from your posted link "just want to add that, if the user has a data connection they can use NTP time, which is even more accurate, as the GPS internal clock might drift and correcting it takes a while." – Kurt Wagner Jul 30 '14 at 23:25
  • @kcoppock I like the idea of pushing, but since I'm dealing with a high volume of synced instructions per second, I don't think the central server would be capable of pushing that many notifications to multiple devices – Kurt Wagner Jul 30 '14 at 23:36

0 Answers0