GLBasic User Manual

Main sections

GETTIMER()

n#=GETTIMER()



Returns the time in 1/1000 sec since the last call to SHOWSCREEN. Calling GETTIMER() before a SHOWSCREEN command will result in a rather large number being returned.

Sample:
// FPS counter
WHILE TRUE
dtime = GETTIMER()
fps = ((1000/dtime)+fps)/2
delay=delay+dtime
IF delay>500 // 1/2 sec
delay=0
showfps=fps
ENDIF
PRINT "FPS: "+showfps+" dtime:"+dtime, 0,0
SHOWSCREEN
WEND


Example Output:
FPS: 60.09950381 dtime:16.66132454

See also...