You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: more accurate local time sync with server time (#3206)
* get a more accurate local time by using half the RTT.
* update
adding change log entry.
* updarte
adding PR number to entry.
* test
Adjusting ClientNetworkTimeSystemTests to account for half RTT adjustment applied in this PR.
* style
Adding a comment about the change
* style
removing whitespace after comment
---------
Co-authored-by: CTHULHU\Ben <benthesim@gmail.com>
// server speedup/slowdowns should not be affected by RTT
45
+
Assert.True(Math.Abs(offsetToTarget)<k_AcceptableRttOffset,$"Expected offset time to be less than {k_AcceptableRttOffset}ms but it was {offsetToTarget}!");
44
46
45
47
// run again, test that we never need to speed up or slow down under stable RTT
// server speedup/slowdowns should not be affected by RTT
59
+
Assert.True(Math.Abs(offsetToTarget)<k_AcceptableRttOffset,$"Expected offset time to be less than {k_AcceptableRttOffset}ms but it was {offsetToTarget}!");
57
60
58
61
// difference between first and second offset should be minimal
Assert.True(expectedSpeedUpTime<k_AcceptableRttOffset,$"Expected local speed up time to be less than {k_AcceptableRttOffset}ms but it was {expectedSpeedUpTime}!");
112
+
// server speedup/slowdowns should not be affected by RTT
113
+
Assert.True(Math.Abs(totalServerSpeedUpTime)<k_AcceptableRttOffset,$"Expected server speed up time to be less than {k_AcceptableRttOffset}ms but it was {expectedServerSpeedUpTime}!");
107
114
108
115
109
-
// run again with RTT ~100ms and see whether we slow down by -0.1f
116
+
// run again with RTT ~100ms and see whether we slow down by -halfRtt
110
117
unscaledLocalTime=timeSystem.LocalTime;
111
118
unscaledServerTime=timeSystem.ServerTime;
112
119
@@ -121,13 +128,13 @@ public void RttCatchupSlowdownTest()
Assert.True(expectedSpeedUpTime<k_AcceptableRttOffset,$"Expected local speed up time to be less than {k_AcceptableRttOffset}ms but it was {expectedSpeedUpTime}!");
136
+
// server speedup/slowdowns should not be affected by RTT
137
+
Assert.True(Math.Abs(totalServerSpeedUpTime)<k_AcceptableRttOffset,$"Expected server speed up time to be less than {k_AcceptableRttOffset}ms but it was {expectedServerSpeedUpTime}!");
0 commit comments