problem calculating time

Blitz3D Forums/Blitz3D Programming/problem calculating time

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

i guess the simplest way is like this, ie. don't flip the 15 millisecs before getting your time result, 20 is the margin of error.

Graphics3D 640,480,0,2

iniTime=MilliSecs()

While Not KeyHit(1)

 tempTime=MilliSecs()-iniTime
 If MilliSecs()>=iniTime+1000 ;1 second test
  If once=0
   once=1
   Latency#=(MilliSecs()-iniTime)/1000.0
   testTime=MilliSecs()-iniTime
   testFloat#=1000/1000.0
  EndIf
 EndIf

 Cls
 Text 0,0,"Latency="+Latency+" testFloat="+testFloat
 Text 0,12,"testTime="+testTime+" iniTime="+iniTime+" tempTime="+tempTime

 If MilliSecs()>=iniTime+1000-15 And MilliSecs()<=iniTime+1000+5
 Else
  Flip
 EndIf

Wend