Skip to content

Commit f249bae

Browse files
test
Tracking down time issue.
1 parent fae6b2f commit f249bae

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

com.unity.netcode.gameobjects/Tests/Runtime/Timing/TimeInitializationTest.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,14 @@ public IEnumerator TestClientTimeInitializationOnConnect([Values(0, 1f)] float s
4242
yield return new WaitUntil(() => server.NetworkTickSystem.ServerTime.Tick > 2);
4343

4444
var serverTimePassed = server.NetworkTickSystem.ServerTime.Time;
45+
var doubleExpectedServerTickCount = (int)System.Math.Floor(serverTimePassed / server.ServerTime.FixedDeltaTimeAsDouble);
4546
var expectedServerTickCount = Mathf.FloorToInt((float)(serverTimePassed * 30));
4647

48+
Debug.Log($"Server Tick: {server.NetworkTickSystem.ServerTime.Tick} Server Time: {server.NetworkTickSystem.ServerTime.Time} ExpDoubTick: {doubleExpectedServerTickCount} ExpTick: {expectedServerTickCount}");
49+
4750
var ticksPassed = server.NetworkTickSystem.ServerTime.Tick - serverTick;
48-
Assert.AreEqual(expectedServerTickCount, ticksPassed);
51+
Assert.AreEqual(doubleExpectedServerTickCount, ticksPassed, "Double calculated tick count failed.");
52+
Assert.AreEqual(expectedServerTickCount, ticksPassed, "FloorToInt calculated tick count failed.");
4953

5054
yield return new WaitForSeconds(clientStartDelay);
5155

0 commit comments

Comments
 (0)