Skip to content

Commit 5869b52

Browse files
Don't forget to multiply by 0.5
1 parent 56ada25 commit 5869b52

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fCraft/Network/PingList.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ public double AveragePingMilliseconds() {
5252
foreach (PingEntry ping in Entries) {
5353
if (ping.TimeSent.Ticks == 0 || ping.TimeReceived.Ticks == 0) continue;
5454

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

69-
double ms = (ping.TimeReceived - ping.TimeSent).TotalMilliseconds;
70+
double ms = (ping.TimeReceived - ping.TimeSent).TotalMilliseconds * 0.5;
7071
totalMs = Math.Max(totalMs, ms);
7172
}
7273
return totalMs;

0 commit comments

Comments
 (0)