chrony-confile 0.1.0

A full-featured Rust library for parsing, editing, validating, and serializing chrony configuration files
Documentation
//! System clock configuration types.
//!
//! These directives control how chrony manages the system clock, including drift file tracking,
//! leap second handling, clock stepping/slewing limits, and temperature compensation.

/// Leap second handling mode for chrony.
///
/// Controls how chrony corrects for leap seconds.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum LeapSecMode {
    /// Follow the system's leap second handling.
    System,
    /// Step the clock immediately on leap second insertion.
    Step,
    /// Slew the clock to gradually adjust for the leap second.
    Slew,
    /// Ignore leap seconds entirely.
    Ignore,
}

#[derive(Debug, Clone, PartialEq)]
pub struct ClockPrecisionConfig { pub precision: f64 }

#[derive(Debug, Clone, PartialEq)]
pub struct CorrTimeRatioConfig { pub ratio: f64 }

#[derive(Debug, Clone, PartialEq)]
pub struct DriftFileConfig { pub path: String, pub interval: Option<u32> }

#[derive(Debug, Clone, PartialEq)]
pub struct FallbackDriftConfig { pub min: i32, pub max: i32 }

#[derive(Debug, Clone, PartialEq)]
pub struct LeapSecTzConfig { pub timezone: String }

#[derive(Debug, Clone, PartialEq)]
pub struct LeapSecListConfig { pub file: String }

#[derive(Debug, Clone, PartialEq)]
pub struct MakeStepConfig { pub threshold: f64, pub limit: i32 }

#[derive(Debug, Clone, PartialEq)]
pub struct MaxChangeConfig { pub offset: f64, pub start: i32, pub ignore: i32 }

#[derive(Debug, Clone, PartialEq)]
pub struct MaxClockErrorConfig { pub error_ppm: f64 }

#[derive(Debug, Clone, PartialEq)]
pub struct MaxDriftConfig { pub drift_ppm: f64 }

#[derive(Debug, Clone, PartialEq)]
pub struct MaxUpdateSkewConfig { pub skew_ppm: f64 }

#[derive(Debug, Clone, PartialEq)]
pub struct MaxSlewRateConfig { pub rate_ppm: f64 }

/// Temperature compensation configuration for chrony.
///
/// Can be specified either as polynomial coefficients (6-argument form) or as a
/// points file (3-argument form).
#[derive(Debug, Clone, PartialEq)]
pub enum TempCompConfig {
    /// Polynomial coefficients form: `tempcomp file interval t0 k0 k1 k2`
    Coefficients { file: String, interval: f64, t0: f64, k0: f64, k1: f64, k2: f64 },
    /// Point file form: `tempcomp file interval points_file`
    PointFile { file: String, interval: f64, points_file: String },
}