Sub Process_Globals
Dim Timer1 As Timer
End Sub
Sub Activity_Create(FirstTime As Boolean)
Timer1.Initialize("tmr",1000)
Timer1.Enabled = True
End Sub
Sub tmr_tick
DateTime.TimeFormat = "hh:mm:ss"
Label1.Text = DateTime.Time(DateTime.Now)
End Sub
This is the correct code - you are reading the Android device time which should be UTC time maintained by an internet connection. If it shows an incorrect time it means that your Android TV box is incorrect. Where is your box getting its UTC reference from?
Sub Process_Globals
Dim Timer1 As Timer
End Sub
Sub Activity_Create(FirstTime As Boolean)
Timer1.Initialize("tmr",1000)
Timer1.Enabled = True
End Sub
Sub tmr_tick
DateTime.TimeFormat = "hh:mm:ss"
Label1.Text = DateTime.Time(DateTime.Now)
End Sub
This is the correct code - you are reading the Android device time which should be UTC time maintained by an internet connection. If it shows an incorrect time it means that your Android TV box is incorrect. Where is your box getting its UTC reference from?
Based on the description in the first post, your Android TV loses precision over time. If there is no internet connection then there isn't anything that you can do to fix it.
With an internet connection you can get the time from a NTP server.
No. As long as you are getting the time using DateTime.Now then your app will not affect the clock precision.
It is possible that your app is leaking a resource and after a month it runs very slow.
Does the clock show the correct time after you restart the app?
Overall, mobile devices are not really built to run apps forever. It is a good practice to kill the app after 24 hours and restart it. You can do it with a second "watchdog" app.
Well, you know that your device loses two minutes after one month, which is around two seconds every twelve hours. So in your timer tick events you could have a correction factor and increase it by two seconds every twelve hours (or one second every six hours) and add it to the reported DateTime(Now) value. It would not "get rid of the issue" because your device probably does not lose exactly two minutes every thirty days, but it would be a useful step forward.