Original Post
Hi I want to calculate the frames per second, so i can display it on screen. Right now I do the following: My problem is that fTimeDifference=0, so I detect that and set it to 0.1, giving me 10,000 frames per second!!! I'm wondering if I am doing this wrong or something.
//start time
DWORD dwTimeStart=GetTickCount();
//.
//.after a while
//.
//time difference between start and end(now)
float fTimeDifference=GetTickCount()-dwTimeStart;
if(fTimeDifference==0)fTimeDifference=0.1;
//1000ms divide by time difference in ms
int nFramesPerSecond=1000/fTimeDifference;