initialization stuff :
currentTime = 0
lastTime = 0
the function :
currentTime = now() - lastTime
if currentTime <33.33
exit
else
frameCounter ++
lastTime = now()
end(or exit)
---------------------------
sample input
figures are in milliseconds .
1. 1000 = 1000 - 0
1000 ! < 33
then frameCounter++
last = now = (1500) //because its in the same function, i assumed the time difference is not that much, so i added 500+)
--------------------------
(again in the next call, i assumed a bigger quantum is passed !compared to the one in the function , so i added 1000+ for each call )
2. 1 500 = 2000-500
1500 !<33.333
then frameCOunter++
last = 2000
---------------------------
the same thing applies here too ( 1000+ for the call and 500+ for updating the lastTime)
3. 1000=3000-2000
1000 !<33.33
then frameCOunter++
last = 2500
-----------------------------
4. 1500 = 4000-2500
1500 !<33.33
then frameCounter++
last = 3000