MCCTeam / Minecraft-Console-Client

Lightweight console for Minecraft chat and automated scripts
https://mccteam.github.io
Other
1.67k stars 402 forks source link

Wrong algorithm for calculating server TPS #2808

Open DGCK81LNN opened 1 month ago

DGCK81LNN commented 1 month ago

https://github.com/MCCTeam/Minecraft-Console-Client/blob/27e66433cdd1997a7ff69e0dfb7ca6d79646e30d/MinecraftClient/McClient.cs#L3307-L3346

The timing of time update packets is not perfect, so the quotient of ticks to elapsed seconds floats around 20.0, sometimes higher than that and sometimes lower. By entirely excluding "instantaneous" TPS samples above 20.0, the calculated average TPS is virtually always less than 20.