From 3f51fd2a296703cddf97a70196cf5768ba86d17e Mon Sep 17 00:00:00 2001 From: terencehill Date: Sun, 27 Sep 2020 12:27:28 +0200 Subject: [PATCH] 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 --- qcsrc/client/hud/panel/engineinfo.qc | 2 +- qcsrc/client/view.qc | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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 } -- 2.39.2