37 inline bool ok()
const
38 {
return m_scale_nominal.
ok(); }
43 {
return m_count_coarse; }
47 {
return m_count_fine; }
51 {
return m_stats.
mean(); }
58 double clock_offset_ppm()
const;
66 const double m_rate_actual;
69 unsigned m_count_coarse;
70 unsigned m_count_fine;
Convert normalized frequency offset to ticks-per-clock.
bool ok() const
Is the scale coefficient large enough to mitigate rounding error?
Simulated clock mimics operation of "ptp_realtime.vhd".
SimulatedClock(double nominal_hz, double actual_hz)
Constructor allows user to set nominal vs actual frequency.
bool ok() const
Confirm initial configuration is valid.
static constexpr double TICKS_PER_SEC
Convert from internal ticks to engineering units.
static constexpr u64 TICKS_PER_SUBNS
Convert from internal ticks to engineering units.
double mean() const
Mean of all inputs to clock_rate(...)
satcat5::ptp::Time clock_now() override
Return the current time if available, TIME_ZERO otherwise.
unsigned num_fine() const
Report the number of fine adjustments.
void run(const satcat5::ptp::Time &dt)
Run simulation for X seconds.
static constexpr unsigned TICK_SCALE_NSEC
Convert from internal ticks to engineering units.
void clock_rate(s64 offset) override
Adjust rate by a normalized frequency offset.
satcat5::ptp::Time clock_adjust(const satcat5::ptp::Time &amount) override
Make a one-time adjustment of the specified magnitude.
unsigned num_coarse() const
Report the number of coarse adjustments.
Helper object for tracking simulation time.
satcat5::util::TimeRef * get_timer()
Accessor for a SatCat5 coarse timer.
void run(const satcat5::ptp::Time &dt)
Advance simulation by X seconds.
A source for ptp::Measurement events, usually a ptp::Client.
High-precision timestamp for use with PTP / IEEE1588.
Generic interface to a numerically-controlled reference clock.
Measure various statistics of a discrete-time series.
double mean() const
Mean of all data points.
The TimeRef API provides access to a monotonic time-counter.
Implement TimeRef API using a memory-mapped performance counter.
Chainable filters for use with ptp::TrackingController.
Define the data structure for a two-way time transfer handshake.
High-precision "Time" object for use with PTP / IEEE1588.
Closed-loop time-tracking clocks and tracking control.
Miscellaneous simulation and test helper functions.