Skip to content

Commit

Permalink
Add stratum 1 support.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidv1992 committed Nov 2, 2023
1 parent 5573187 commit da55461
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions ntpd/src/daemon/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use super::{
use std::{collections::HashMap, future::Future, marker::PhantomData, pin::Pin, sync::Arc};

use ntp_proto::{
KalmanClockController, KeySet, NtpClock, NtpDuration, PeerSnapshot, SourceDefaultsConfig,
SynchronizationConfig, SystemSnapshot, TimeSyncController,
KalmanClockController, KeySet, NtpClock, NtpDuration, NtpLeapIndicator, PeerSnapshot,
SourceDefaultsConfig, SynchronizationConfig, SystemSnapshot, TimeSyncController,
};
use ntp_udp::{EnableTimestamps, InterfaceName};
use tokio::{sync::mpsc, task::JoinHandle};
Expand Down Expand Up @@ -193,11 +193,16 @@ impl<C: NtpClock, T: Wait> System<C, T> {
keyset: tokio::sync::watch::Receiver<Arc<KeySet>>,
) -> (Self, DaemonChannels) {
// Setup system snapshot
let system = SystemSnapshot {
let mut system = SystemSnapshot {
stratum: synchronization_config.local_stratum,
..Default::default()
};

if synchronization_config.local_stratum == 1 {
// We are a stratum 1 server so mark our selves synchronized.
system.time_snapshot.leap_indicator = NtpLeapIndicator::NoWarning;
}

// Create communication channels
let (synchronization_config_sender, synchronization_config_receiver) =
tokio::sync::watch::channel(synchronization_config);
Expand Down

0 comments on commit da55461

Please sign in to comment.