What is the best way to check the difference between two GETTIMERALL values.
At the moment, I use :
QuoteABS(GETTIMERALL()-loop.currentTime)>=5000.0
but I'm not sure whether
loop.currentTime=GETTIMERALL()+5000.0
IF GETTIMERALL()>=loop.currentTimer
would be better
one time stamp can't be bigger than an stamp taken before (unless it wraps around, but that's a a few days)
I always do:
now% = GETTIMERALL()
IF loop.stoptime > now
// do something
loop.stoptime = now + 5000
ENDIF
I normally do:-
now=gettimerall()
while 1=1
if gettimerall()-now>5000
dosomething
now=gettimerall()
endif
wend
Works for me...
Cheers
the "cool" thing about my method is, that if you initialize the stoptime variable with 0, it will be triggered on the first run.
True, plus you are using less calculations on the check. I like finding very slightly faster code over stuff used for years :) Similar feeling when I discovered the old A=1-A to toggle a Boolean. Brought a smile to my face that did after years of ignorance.
Cheers