8000 GitHub - hdoordt/statime at simulation-v2
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Implementation of the Precision Time Protocol (PTP) in Rust

License

Notifications You must be signed in to change notification settings

hdoordt/statime

 
 

Repository files navigation

Statime

codecov

Statime is a work in progress Rust implementation of PTP version 2.1 (IEEE 1588-2019). It is currently highly in flux and not yet usable.

Statime - PTP in Rust

The current state of the project is such that the main binary, when compiled, measures and outputs the time difference to any ptp master clock happening to be sending in the network it listens to.

Structure

The library has been built in a way to try and be platform-agnostic. To do that, the network and clock have been abstracted.

Many things are event-based where the user needs to call a function on the ptp instance object to let it handle e.g. an incoming network packet.

Rust version

For compiling this software we advise using the latest version of cargo/rustc as available through rustup. At time of writing this is 1.58.1.

Running with elevated privileges

Because of the use of ports 319 and 320 in the PTP protocol, the code here needs to be run as root. It is best to build the code as a non-root user with

cargo +nightly build

and then run it as root with

sudo ./target/debug/linux -i <ETHERNET INTERFACE NAME>

PTPd setup for testing

PTPd can be used as a ptp master clock for testing. Because of the port usage required by the PTP standard, this master clock must be on a different machine than that used to run the code in this repository. On Ubuntu, it can be installed with

apt install ptpd

You probably wont want to run this continuously as a service, so disable it with

service ptpd disable

Then, to start ptpd, as root run

ptpd -V -n -M -i <INTERFACE>

where <INTERFACE> is the netwerk interface you want ptpd to use. Here -n disables clock adjustment by ptpd, and -M ensures that it runs in master mode only.

Support our work

The development of Statime is kindly supported by the NLnet Foundation.

SIDN Fonds is supporting us with a grant to develop clock devices running Statime and ntpd-rs, in collaboration with SIDN Labs' TimeNL.

We seek involvement and/or sponsoring of interested parties, see the announcement here.

About

Implementation of the Precision Time Protocol (PTP) in Rust

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 94.3%
  • TeX 4.3%
  • Gnuplot 1.4%
0