Time Synchronizer¶
TimeSynchronizer emits periodic time-sync ticks for the network runtime.
Source mapping¶
src/Nalix.Network/Timekeeping/TimeSynchronizer.cs
What it does¶
- runs a background tick loop
- raises
TimeSynchronizedwith the current Unix timestamp - can be enabled or disabled through
IsTimeSyncEnabled - can dispatch handlers inline or via fire-and-forget thread-pool work
Basic usage¶
TimeSynchronizer sync = InstanceManager.Instance.GetOrCreateInstance<TimeSynchronizer>();
sync.TimeSynchronized += ts =>
{
Console.WriteLine($"tick={ts}");
};
sync.Activate();
Important settings¶
Periodcontrols the tick intervalFireAndForgetavoids blocking the tick loop with slow handlersIsTimeSyncEnabledis the main on/off switch