https://github.com/passcod/timesimp
Simple sans-io timesync client and server
https://github.com/passcod/timesimp
Last synced: 9 months ago
JSON representation
Simple sans-io timesync client and server
- Host: GitHub
- URL: https://github.com/passcod/timesimp
- Owner: passcod
- License: other
- Created: 2025-04-27T13:20:37.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-05-07T04:16:18.000Z (9 months ago)
- Last Synced: 2025-05-07T04:30:59.685Z (9 months ago)
- Language: Rust
- Homepage:
- Size: 153 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# 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][paper], 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.
[paper]: https://web.archive.org/web/20160310125700/http://mine-control.com/zack/timesync/timesync.html
## How do I use it?
### Rust
- [Crate][lib-rust]
- [API Docs][docs-rust]
[lib-rust]: https://lib.rs/crate/timesimp
[docs-rust]: https://docs.rs/timesimp
### Node.js
- [NPM][lib-node]
- [API Docs][docs-node]
[lib-node]: https://www.npmjs.com/package/timesimp
[docs-node]: https://passcod.github.io/timesimp/js/