Reputation: 797
I'm trying to get the GPS time for a location using location.getTime on a location listener using GPS_PROVIDER in my requestLocationUpdates. I was expecting the provided time to be the time from the GPS clock - accurate to billionths of a second, but rounded to the millisecond. What I am getting depends on the platform, but certainly doesn't seem to be what I'm expecting.
On SGS 11 - Android 2.3.3, the returned value is always an exact second, with the millisecond portion always .000. From my experience with GPSs, it seems to me unlikely that every polling of the GPS will occur exactly on the whole second interval.
On an HTC-A7275 Android 2.3.3 - I'm getting the phone's system time, certainly not the GPS time.
I confirmed these findingsby messing with the phone's time and examining the location time.
The time stamps in NMEA sentences on the SGS 11 are provided to 3 decimals of a second, but on the HTC, they're all xxx.0. The problem using NMEA is that it's really messy getting the date and time and full position from MNEA: It is only in the GPGGA sentence that has altitude, but it has no date stamp so it get's tricky around midnight UTC.
I am looking for precise times - preferably to the millisecond for my track logger, so that I can reliably compare tracks from different players.
Has anyone done any more work on this?
Upvotes: 7
Views: 4794
Reputation: 23556
Expensive GPS units use "pulse-per-second" protocols to achieve sub-millisecond accuracy, however I haven't heard of this protocol or interface available on cheap GPS receivers we have in our phones. So the best accuracy you can achieve with GPS messages is within a 1-2 seconds range.
Re:NTP on Android, it's much better solution, but unlikely to achieve clock accuracy beyond 50-100ms on contemporary wireless networks.
Upvotes: 1