Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Algorithm support for periodic sources. #1768

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

davidv1992
Copy link
Member

No description provided.

Copy link

codecov bot commented Dec 13, 2024

Codecov Report

Attention: Patch coverage is 97.56098% with 16 lines in your changes missing coverage. Please review.

Project coverage is 82.01%. Comparing base (ef33a8c) to head (cda78f3).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
ntp-proto/src/algorithm/kalman/source.rs 98.12% 10 Missing ⚠️
ntpd/src/force_sync/algorithm.rs 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1768      +/-   ##
==========================================
+ Coverage   81.60%   82.01%   +0.40%     
==========================================
  Files          66       66              
  Lines       20671    21220     +549     
==========================================
+ Hits        16869    17403     +534     
- Misses       3802     3817      +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@davidv1992 davidv1992 force-pushed the algorithm-periodic-source branch from 2df1ed3 to 3ccb6ae Compare December 13, 2024 15:30
@davidv1992 davidv1992 force-pushed the algorithm-periodic-source branch from 3ccb6ae to cda78f3 Compare December 13, 2024 15:31
@davidv1992 davidv1992 marked this pull request as ready for review December 13, 2024 15:31
@@ -34,6 +34,7 @@ struct SourceSnapshot<Index: Copy> {
state: KalmanState,
wander: f64,
delay: f64,
period: Option<f64>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should document somewhere what period actually means.

@@ -24,6 +24,11 @@ pub(super) fn select<Index: Copy>(
let mut bounds: Vec<(f64, BoundType)> = Vec::with_capacity(2 * candidates.len());

for snapshot in candidates.iter() {
if snapshot.period.is_some() {
Copy link
Member

@rnijveld rnijveld Dec 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although nothing would particularly go wrong (i.e. I think we would just not synchronize at all), we could now have the situation where we only have periodic sources. Either we should probably require at least one non-periodic source, or we could have some (not that great) option that uses our current clock time for periodic sources (but that would require a whole bunch of additional changes probably).

if cur > max {
max = cur;
maxt = *time;
BoundType::Start => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should probably update the comment on top of this function (and/or maybe add a few inline comments), to explain why we now look for both the lower and higher bound.

}
}

// Catch programming errors. If this ever fails there is high risk of missteering, better fail hard in that case
assert_eq!(maxlow, maxhigh);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a third parameter for the panic message? Or at least explain 'this' in the comment?

// Catch programming errors. If this ever fails there is high risk of missteering, better fail hard in that case
assert_eq!(maxlow, maxhigh);
let max = maxlow;

if max >= synchronization_config.minimum_agreeing_sources && max * 4 > bounds.len() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should probably update the documentation of minimum agreeing sources to indicate that it refers to non-periodic sources only?

@michielp1807 michielp1807 mentioned this pull request Dec 19, 2024
2 tasks
@michielp1807 michielp1807 linked an issue Dec 19, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modify algorithm to deal with periodic time sources
2 participants