From d72036a01474e96e5de4dcab8756b052ae9e834e Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Tue, 19 Sep 2023 14:37:30 +1000 Subject: [PATCH] Fix occasional NaN sdev in server timing reports Signed-off-by: bones_was_here --- sv_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sv_main.c b/sv_main.c index 15ac48d6..c4168d2e 100644 --- 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) -- 2.39.2