Skip to content

Commit 04f3c0d

Browse files
committed
Move Time.Update() back, use GetTime() to get real-world time when not ingame AscensionGameDev#2566
1 parent c06d1ab commit 04f3c0d

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

Intersect.Client.Core/Core/Main.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@ public static void Update(TimeSpan deltaTime)
9898
Globals.InputManager.Update(deltaTime);
9999
Audio.Update();
100100

101-
Time.Update();
102-
103101
Globals.OnGameUpdate(deltaTime);
104102
}
105103
}
@@ -269,6 +267,7 @@ private static void ProcessGame()
269267
}
270268

271269
Graphics.UpdatePlayerLight();
270+
Time.Update();
272271
}
273272

274273
public static void JoinGame()

Intersect.Client.Core/General/Time.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,6 @@ public static void LoadTime(DateTime timeUpdate, Color clr, float rate)
2929

3030
public static void Update()
3131
{
32-
if (!Networking.Network.IsConnected)
33-
{
34-
sServerTime = DateTime.Now;
35-
return;
36-
}
37-
3832
if (sUpdateTime < Timing.Global.Milliseconds)
3933
{
4034
var ts = new TimeSpan(0, 0, 0, 0, (int) (1000 * sRate));
@@ -85,7 +79,12 @@ private static float LerpVal(float val, float target, float amt)
8579

8680
public static string GetTime()
8781
{
88-
return sServerTime.ToString("h:mm:ss tt");
82+
var time = sServerTime;
83+
if (Globals.GameState != GameStates.InGame)
84+
{
85+
time = DateTime.Now;
86+
}
87+
return time.ToString("h:mm:ss tt");
8988
}
9089

9190
public static ColorF GetTintColor()

0 commit comments

Comments
 (0)