What you really want is something like this (in your mainLoop):
frames++; if(time<secondsTimer()){ time = secondsTimer(); printf("Average FPS from the last 2 seconds: %d",(frames+lastFrames)/2); lastFrames = frames; frames = 0; }
If you know how to handle structures / arrays, it will be easy for you to extend this example to 4 seconds instead of 2. But if you want to get more detailed help, you really need to indicate WHY you do not have access to the exact timer (which architecture, language ) - otherwise everything seems like a guess ...
source share