sbox-issues icon indicating copy to clipboard operation
sbox-issues copied to clipboard

Time.Now loss of precision after running > 24 hours

Open jusvit opened this issue 6 months ago • 7 comments

Describe the bug

When dedicated servers/lobbies run for longer than 24 hours, Time.Now loses floating point precision and causes everyone's movement to feel jittery and screwed (Not sure if related).

After ~11.6 hours (41,943 seconds), millisecond precision is lost

The longer the time tracked, the coarser the granularity becomes

Double-precision (64-bit) floats provide ~15-17 digits and maintain millisecond precision for millions of years

Image

To Reproduce

Run a server more than 30 hours and try out the default player controller on it.

Expected behavior

Time should not lose precision since everything is tied to it.

Media/Files

Move internal time keeping to a double instead of a float in year 2025

Additional context

No response

jusvit avatar Apr 16 '25 08:04 jusvit