Android Question Time is not stable and not accurate as well !!!

Alhootti

Active Member
I'm using an app in my Tv Box working in Android platform.
the issue is each day i get +4 seconds extra.
even i switch off it then switch on it the same issue.
B4X:
Sub Activity_Create(FirstTime As Boolean)
    If (FirstTime) Then
        PWS.KeepAlive(True) ' Screen on always
        Timer1.Initialize("tmr",1000)
        Timer1.Enabled = True
    End If
    Activity.LoadLayout("Layout")
    InitCanvas
    InitLabel
    End Sub
 
    Sub tmr_tick
    DateTime.TimeFormat = "HH:mm:ss"
    Label1.Text = DateTime.Time(DateTime.Now)
    End Sub

Note : I don't want to sync it with internet (WiFi)
How i can solve this issue ?
 
Last edited:

Alhootti

Active Member
Anyway i corrected it to compatible with my time by this code:
B4X:
Dim TempCorrectTime As Long = CorrectTime(TempClockTime) + "900000"
 
Upvote 0

emexes

Expert
Licensed User
Anyway i corrected it to compatible with my time by this code:
B4X:
Dim TempCorrectTime As Long = CorrectTime(TempClockTime) + "900000"

It would be better if you set it explicitly to the date and time that you last corrected the Android system time, eg if you set it to correct time on Monday morning at quarter past nine, then:

B4X:
    DateTime.DateFormat = "MM/dd/yyyy"    'default date format
    DateTime.timeformat = "HH:mm:ss"    'default time format
 
    LastCorrectDateTimeNow = DateTime.DateTimeParse("08/12/2024", "09:15:00")

and then, say, at quarter past nine on Wednesday morning (2 days later) you'd expect the adjustment to have worked up to be -8 seconds.
 
Upvote 0
Top