]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Fix occasional NaN sdev in server timing reports
authorbones_was_here <bones_was_here@xonotic.au>
Tue, 19 Sep 2023 04:37:30 +0000 (14:37 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Tue, 19 Sep 2023 15:46:09 +0000 (01:46 +1000)
Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
sv_main.c

index 15ac48d6500dbb997f42f1acaeae21621f0925b6..c4168d2e5d41f0d264695d084a69311104fa1e33 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -2561,7 +2561,8 @@ double SV_Frame(double time)
                        {
                                sv.perf_offset_max = sv.perf_acc_offset_max;
                                sv.perf_offset_avg = sv.perf_acc_offset / sv.perf_acc_offset_samples;
-                               sv.perf_offset_sdev = sqrt(sv.perf_acc_offset_squared / sv.perf_acc_offset_samples - sv.perf_offset_avg * sv.perf_offset_avg);
+                               sv.perf_offset_sdev = sv.perf_acc_offset_squared / sv.perf_acc_offset_samples - sv.perf_offset_avg * sv.perf_offset_avg;
+                               sv.perf_offset_sdev = sv.perf_offset_sdev > 0 ? sqrt(sv.perf_offset_sdev) : 0;
                        }
 
                        if (sv.perf_lost > 0 && reporting)