git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4768
d7cf8633-e32d-0410-b094-
e92efae38249
static int framerate = 0, framecount = 0;
double newtime;
newtime = Sys_DoubleTime();
- if (newtime < nexttime)
- framecount++;
- else
+ if (newtime >= nexttime)
{
framerate = (int) (framecount / (newtime - lasttime) + 0.5);
lasttime = newtime;
- nexttime = lasttime + 0.2;
- framecount = 1;
+ nexttime = max(nexttime + 1, lasttime - 1);
+ framecount = 0;
}
+ framecount++;
calc = framerate;
}
snprintf(fpsstring, sizeof(fpsstring), "%4i fps", calc);