Android Question timers lag

eric Allen

Member
Licensed User
Longtime User
What would be the best way to get correct time elapsed in between ticks to get correct milliseconds

In game view I use timer for gameloop but for any game time a timer us either slow or fast. Could I compare an old time form system and new time from system and get the millisecond difference. Might of answeredy own post butvwant to know if that's the correct way.
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim endtime, starttime As Long
End Sub
Sub Activity_Create(FirstTime As Boolean)
  starttime = DateTime.Now

and then when you finished

B4X:
endtime = DateTime.Now
Dim diff As Long = endtime-starttime
Log(diff)
 
Upvote 0
Top