Mads
Multi-Agent Distributed System
Loading...
Searching...
No Matches
Mads::ClockOffsetEstimator Class Reference

Accumulates ClockSamples and returns the classic NTP "best of N": the retained sample with the smallest round-trip delay, i.e. the one least polluted by queuing delay along the path. More...

#include <clock_offset.hpp>

Public Member Functions

 ClockOffsetEstimator (size_t keep=8)
 
void add (const ClockSample &s)
 
ClockOffsetResult best () const
 
ClockOffsetResult median () const
 
void reset ()
 

Detailed Description

Accumulates ClockSamples and returns the classic NTP "best of N": the retained sample with the smallest round-trip delay, i.e. the one least polluted by queuing delay along the path.

Definition at line 100 of file clock_offset.hpp.

Constructor & Destructor Documentation

◆ ClockOffsetEstimator()

Mads::ClockOffsetEstimator::ClockOffsetEstimator ( size_t  keep = 8)
explicit

Member Function Documentation

◆ add()

void Mads::ClockOffsetEstimator::add ( const ClockSample s)

Estimates s and retains it, evicting the oldest sample once more than keep are held.

◆ best()

ClockOffsetResult Mads::ClockOffsetEstimator::best ( ) const

The min-delay sample, with jitter_us/samples filled in across every retained sample. {valid=false} if add() was never called.

◆ median()

ClockOffsetResult Mads::ClockOffsetEstimator::median ( ) const

The median offset_us across every retained sample (delay_us/hops/ source of the median-offset sample are carried along, for display only – best() is what should drive adoption). {valid=false} if empty.

◆ reset()

void Mads::ClockOffsetEstimator::reset ( )

The documentation for this class was generated from the following file: