From: terencehill Date: Sun, 27 Sep 2020 10:27:28 +0000 (+0200) Subject: Use gettime(GETTIME_FRAMESTART) instead of gettime(GETTIME_REALTIME) to calculate... X-Git-Tag: xonotic-v0.8.5~743^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3f51fd2a296703cddf97a70196cf5768ba86d17e;p=xonotic%2Fxonotic-data.pk3dir.git Use gettime(GETTIME_FRAMESTART) instead of gettime(GETTIME_REALTIME) to calculate qc fps as the latter becomes inaccurate after a while (at least on Windows 10). It should be noted that gettime(GETTIME_FRAMESTART) returns the value of the engine variable realtime which is used by the engine to calculate the engine fps --- diff --git a/qcsrc/client/hud/panel/engineinfo.qc b/qcsrc/client/hud/panel/engineinfo.qc index 85d425977..4d7fe5c77 100644 --- a/qcsrc/client/hud/panel/engineinfo.qc +++ b/qcsrc/client/hud/panel/engineinfo.qc @@ -43,7 +43,7 @@ void HUD_EngineInfo() mySize -= '2 2 0' * panel_bg_padding; } - float currentTime = gettime(GETTIME_REALTIME); + float currentTime = gettime(GETTIME_FRAMESTART); if(autocvar_hud_panel_engineinfo_framecounter_exponentialmovingaverage) { float currentframetime = currentTime - prevfps_time; diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index ee9164bae..6eb3c8515 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -372,7 +372,8 @@ void fpscounter_update() if(!STAT(SHOWFPS)) return; - float currentTime = gettime(GETTIME_REALTIME); + float currentTime = gettime(GETTIME_FRAMESTART); + showfps_framecounter += 1; if(currentTime - showfps_prevfps_time > STAT(SHOWFPS)) { @@ -388,7 +389,7 @@ void fpscounter_update() STATIC_INIT(fpscounter_init) { - float currentTime = gettime(GETTIME_REALTIME); + float currentTime = gettime(GETTIME_FRAMESTART); showfps_prevfps_time = currentTime; // we must initialize it to avoid an instant low frame sending }