#sync #networking #sans-io #time

timesimp

Simple sans-io timesync client and server

3 releases (1 stable)

Uses new Rust 2024

new 1.0.0 Apr 28, 2025
0.0.2 Apr 28, 2025
0.0.1 Apr 27, 2025

#130 in Date and time

Apache-2.0 OR MIT

27KB
334 lines

Time simp ⏰

Simple sans-io timesync client and server.

How does it work?

Timesimp is based on the averaging method described in Simpson (2002), A Stream-based Time Synchronization Technique For Networked Computer Games, but with a corrected delta calculation. Compared to NTP, it's a simpler and less accurate time synchronisation algorithm that is usable over network streams, rather than datagrams. Simpson asserts they were able to achieve accuracies of 100ms or better, which is sufficient in many cases; my testing gets accuracies well below 5ms. The main limitation of the algorithm is that round-trip-time is assumed to be symmetric: if the forward trip time is different from the return trip time, then an error is induced equal to the value of the difference in trip times.

This library provides a sans-io implementation: you bring in your transport and storage, you get time offsets. There's the core Rust crate and Node.js bindings.

How do I use it?

Rust

Node.js

Dependencies

~5MB
~74K SLoC