Made ElapsedTimeSyncHandler use Runtime.CurrentRuntime instead of creating a stopwatch per-room.

This commit is contained in:
Hipposgrumm 2025-12-06 19:00:52 -07:00
parent dcbdc93bbd
commit ad303f569d
2 changed files with 1 additions and 4 deletions

View File

@ -10,7 +10,7 @@ class ElapsedTimeSyncHandler : CommandHandler {
if (client.Room != null) {
NetworkObject cmd = new();
NetworkObject obj = new();
obj.Add("arr", new string[] { "RTM", "-1", client.Room.ElapsedTime.ElapsedMilliseconds.ToString() });
obj.Add("arr", new string[] { "RTM", "-1", Runtime.CurrentRuntime.ToString() });
cmd.Add("c", "RTM");
cmd.Add("p", obj);
client.Send(NetworkObject.WrapObject(1, 13, cmd).Serialize());

View File

@ -1,5 +1,4 @@
using System;
using System.Diagnostics;
using sodoffmmo.Data;
namespace sodoffmmo.Core;
@ -19,7 +18,6 @@ public class Room {
public bool AllowChatOverride { get; set; } = false;
public NetworkArray RoomVariables = new();
public readonly Stopwatch ElapsedTime = new Stopwatch();
public Room(string? name, string? group = null, bool autoRemove = false) {
Id = ++MaxId;
@ -35,7 +33,6 @@ public class Room {
}
AutoRemove = autoRemove;
rooms.Add(Name, this);
ElapsedTime.Start();
}
public int ClientsCount => clients.Count;