rtime_refclock/lib.rs
1//! Reference clock drivers for the [rTime](https://github.com/ZerosAndOnesLLC/rTime)
2//! NTP/PTP time synchronization daemon.
3//!
4//! Reference clocks — a local GPS receiver or a PPS pulse-per-second source — provide a
5//! stratum-0 time reference so a host can serve time without an upstream network peer.
6//! Drivers are gated behind cargo features so the dependency and syscall surface is only
7//! compiled when needed.
8//!
9//! # Features
10//!
11//! - `gps` — enables the `gps` NMEA/serial GPS driver.
12//! - `pps` — enables the `pps` pulse-per-second ([RFC 2783](https://www.rfc-editor.org/rfc/rfc2783)) driver.
13//!
14//! The crate error type is [`RefClockError`].
15
16#[cfg(feature = "gps")]
17pub mod gps;
18#[cfg(feature = "pps")]
19pub mod pps;
20
21#[derive(Debug, thiserror::Error)]
22pub enum RefClockError {
23 #[error("device not found: {0}")]
24 DeviceNotFound(String),
25 #[error("parse error: {0}")]
26 ParseError(String),
27 #[error("I/O error: {0}")]
28 Io(#[from] std::io::Error),
29 #[error("PPS: no edge detected within timeout")]
30 PpsTimeout,
31}