Skip to main content

chrony_confile/ast/
clock.rs

1//! System clock configuration types.
2//!
3//! These directives control how chrony manages the system clock, including drift file tracking,
4//! leap second handling, clock stepping/slewing limits, and temperature compensation.
5
6/// Leap second handling mode for chrony.
7///
8/// Controls how chrony corrects for leap seconds.
9#[derive(Debug, Clone, Copy, PartialEq, Eq)]
10pub enum LeapSecMode {
11    /// Follow the system's leap second handling.
12    System,
13    /// Step the clock immediately on leap second insertion.
14    Step,
15    /// Slew the clock to gradually adjust for the leap second.
16    Slew,
17    /// Ignore leap seconds entirely.
18    Ignore,
19}
20
21#[derive(Debug, Clone, PartialEq)]
22pub struct ClockPrecisionConfig { pub precision: f64 }
23
24#[derive(Debug, Clone, PartialEq)]
25pub struct CorrTimeRatioConfig { pub ratio: f64 }
26
27#[derive(Debug, Clone, PartialEq)]
28pub struct DriftFileConfig { pub path: String, pub interval: Option<u32> }
29
30#[derive(Debug, Clone, PartialEq)]
31pub struct FallbackDriftConfig { pub min: i32, pub max: i32 }
32
33#[derive(Debug, Clone, PartialEq)]
34pub struct LeapSecTzConfig { pub timezone: String }
35
36#[derive(Debug, Clone, PartialEq)]
37pub struct LeapSecListConfig { pub file: String }
38
39#[derive(Debug, Clone, PartialEq)]
40pub struct MakeStepConfig { pub threshold: f64, pub limit: i32 }
41
42#[derive(Debug, Clone, PartialEq)]
43pub struct MaxChangeConfig { pub offset: f64, pub start: i32, pub ignore: i32 }
44
45#[derive(Debug, Clone, PartialEq)]
46pub struct MaxClockErrorConfig { pub error_ppm: f64 }
47
48#[derive(Debug, Clone, PartialEq)]
49pub struct MaxDriftConfig { pub drift_ppm: f64 }
50
51#[derive(Debug, Clone, PartialEq)]
52pub struct MaxUpdateSkewConfig { pub skew_ppm: f64 }
53
54#[derive(Debug, Clone, PartialEq)]
55pub struct MaxSlewRateConfig { pub rate_ppm: f64 }
56
57/// Temperature compensation configuration for chrony.
58///
59/// Can be specified either as polynomial coefficients (6-argument form) or as a
60/// points file (3-argument form).
61#[derive(Debug, Clone, PartialEq)]
62pub enum TempCompConfig {
63    /// Polynomial coefficients form: `tempcomp file interval t0 k0 k1 k2`
64    Coefficients { file: String, interval: f64, t0: f64, k0: f64, k1: f64, k2: f64 },
65    /// Point file form: `tempcomp file interval points_file`
66    PointFile { file: String, interval: f64, points_file: String },
67}