dondev - Precise Net Clock

The engine's server time is off by your ping. This one isn't.

Timed abilities, cooldowns, countdowns, hit rewind and anti-cheat time stamps all need the client to know what time it is on the server. Unreal's Get Server World Time Seconds has no latency correction, so on a client it reads behind by about half the round trip plus a frame. Adding half the ping by hand still leaves 9 to 13 ms. Precise Net Clock measures the link continuously and gives every client the server's time to within about a millisecond.

Precise Net Clock adds a world subsystem, a small component the server gives every player automatically, and Blueprint nodes:

  • Accurate - every ping sets hard limits on the server clock (no packet can arrive before it was sent), and the clock fits the tightest of them, minute after minute. Measured, median of 6 runs each (UE 5.8): 0.09 ms on LAN, 0.25 ms at 130 ms ping, 0.54 ms at 240 ms ping, 0.32 ms with 10% packet loss.

  • Drift tracking - clocks on two PCs run at slightly different rates. The plugin measures the difference and corrects for it, so the clock stays right over a long session (1.1 ms with an extreme 200 ppm drift in the benchmark).

  • Drop-in - Get Precise Server Time is the same clock as Get Server World Time Seconds (it pauses and dilates with the server), just correct. Get Precise Server Real Time gives the server's real-time clock for logs, long timers and time stamps.

  • Smooth - corrections are slewed in gradually; the clock never jumps and never runs backwards.

  • Helpers - Seconds Until Server Time, Server Time To Local Time and back, Is Precise Net Clock Synced, Wait For Precise Net Clock Sync (latent node), On Clock Synced, Round Trip Time and a guaranteed worst-case Error Bound.

  • Tiny bandwidth - one 47-byte ping and one 60-byte pong, twice a second: about 95 B/s up and 120 B/s down per client. The server rate-limits pings, so a client can't flood it.

  • See it working - the PreciseNetClock.Debug console command shows a live overlay: server time, how far the engine's clock is behind, round trip, drift, bandwidth and a graph of the last minute of pings. On a dedicated server it prints the same to the log.

  • Works everywhere multiplayer does - dedicated and listen servers, Play In Editor (Play As Client and Listen Server), legacy replication and Iris.

Honest about the limits

  • If a connection is slower one way than the other, half of that difference is error that no ping-pong clock can detect. The benchmark includes that case.

  • The Error Bound node is a guaranteed worst case (about the round trip); the typical error is far smaller.

  • The server never reads or trusts client time stamps.

  • It is a clock, not lag compensation; use it to build lag compensation, synced events and timers.

No setup. Enable the plugin: the server adds the clock to every player and clients sync within about 2 seconds of joining. Replace Get Server World Time Seconds with Get Precise Server Time. All settings are in Project Settings > Plugins > Precise Net Clock.