Skip to content
Permalink
Browse files

Don't forget to multiply by 0.5

  • Loading branch information...
UnknownShadow200 committed Jun 22, 2017
1 parent 56ada25 commit 5869b52bba7fb7ff1a839c6fe87b97f049d3a68e
Showing with 3 additions and 2 deletions.
  1. +3 −2 fCraft/Network/PingList.cs
@@ -52,7 +52,8 @@ public struct PingEntry {
foreach (PingEntry ping in Entries) {
if (ping.TimeSent.Ticks == 0 || ping.TimeReceived.Ticks == 0) continue;

totalMs += (ping.TimeReceived - ping.TimeSent).TotalMilliseconds;
// Half, because received->reply time is actually twice time it takes to send data
totalMs += (ping.TimeReceived - ping.TimeSent).TotalMilliseconds * 0.5;
measures++;
}
return measures == 0 ? 0 : (totalMs / measures);
@@ -66,7 +67,7 @@ public struct PingEntry {
foreach (PingEntry ping in Entries) {
if (ping.TimeSent.Ticks == 0 || ping.TimeReceived.Ticks == 0) continue;

double ms = (ping.TimeReceived - ping.TimeSent).TotalMilliseconds;
double ms = (ping.TimeReceived - ping.TimeSent).TotalMilliseconds * 0.5;
totalMs = Math.Max(totalMs, ms);
}
return totalMs;

0 comments on commit 5869b52

Please sign in to comment.
You can’t perform that action at this time.