Android Question GPS UTC Time

Harris

Expert
Licensed User
Longtime User
Both system time and GPS time return the same time.
I thought GPS time would return a UTC where I would have to compute the timezone offset???
This is the question...


I recently had an issue where the device lost accurate time (set it back to last year). When user logs in, it records the system time as START. When a user logs out, a trigger will mark each (associated) record from START date until now with a ShiftID. If previous data exists - and the current date was reset (to older date), the system will print MANY reports that are not relevant.

B4X:
Sub CheckSystemGPS
   
    If GPSServMod.lat1 <> 0 Then
        Dim gpsdate As Long
        Dim sysdate As Long
        sysdate = DateTime.Now
        gpsdate = GPSServMod.gLoc.fTime ' this is from GPS location provider since Fused Location always returns System time.
       
        Log(" GPS date string: "&DateTime.Date(gpsdate)&"  "&DateTime.Time(gpsdate)&"  "&gpsdate)
        Log(" Sys date string: "&DateTime.Date(sysdate)&"  "&DateTime.Time(sysdate)&"  "&sysdate)
           
    End If
   
End Sub

So, I want to ensure that the system time is (close) to the GPS time before I allow the user to proceed with login. I know I cannot set the system time without root - but I can tell him/her about the issue and allow them to set it correctly.
 

Harris

Expert
Licensed User
Longtime User
What is the output of these two logs?

GPS date string: 2017/05/15 09:33 1494865998000
Sys date string: 2017/05/15 09:31 1494865897600
GPS date string: 2017/05/15 09:33 1494865998000
Sys date string: 2017/05/15 09:31 1494865898600
GPS date string: 2017/05/15 09:33 1494865998000
Sys date string: 2017/05/15 09:31 1494865899600
GPS date string: 2017/05/15 09:33 1494865998000
Sys date string: 2017/05/15 09:31 1494865900600
GPS date string: 2017/05/15 09:33 1494865998000
Sys date string: 2017/05/15 09:31 1494865901600
GPS date string: 2017/05/15 09:33 1494865998000
Sys date string: 2017/05/15 09:31 1494865902600
GPS date string: 2017/05/15 09:33 1494865998000
Sys date string: 2017/05/15 09:31 1494865903601
GPS date string: 2017/05/15 09:33 1494865998000
Sys date string: 2017/05/15 09:31 1494865904601
 
Upvote 0
Top