We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2dc2204 commit 29b9797Copy full SHA for 29b9797
ntp-proto/src/system.rs
@@ -43,11 +43,13 @@ pub struct TimeSnapshot {
43
impl TimeSnapshot {
44
pub fn root_dispersion(&self, now: NtpTimestamp) -> NtpDuration {
45
let t = (now - self.root_variance_base_time).to_seconds();
46
+ // Note: dispersion is the standard deviation, so we need a sqrt here.
47
NtpDuration::from_seconds(
- self.root_variance_base
48
+ (self.root_variance_base
49
+ t * self.root_variance_linear
50
+ t.powi(2) * self.root_variance_quadratic
- + t.powi(3) * self.root_variance_cubic,
51
+ + t.powi(3) * self.root_variance_cubic)
52
+ .sqrt(),
53
)
54
}
55
0 commit comments