MedEx.ClockAlign (med_ex v0.2.0)

Copy Markdown View Source

Exact affine clock bounds from supplied rate and timestamp-error qualifications.

Times are already normalized to microseconds. A rational is an integer or {numerator, nonzero_denominator}. Policy supplies positive a_min/a_max, combined timestamp/model epsilon_us, explicit host/device generation, host_now_us, max_probe_age_us, inclusive valid_device_us, and nonnegative holdover_rate (extra host microseconds per device microsecond outside the observed span). Zero holdover rate explicitly assumes no additional wander.

These bounds/validity assumptions must come from caller qualification; this solver cannot establish them. Epsilon must already cover device timestamp error in host units. Probes contain generation, h1, d2, d3, h4 with integer timestamps. Foreign, malformed or stale input fails; only the newest 64 otherwise valid probes constrain the polygon. Retained inputs preserve provenance.

An anchor supplies generation, sample_index, device_us, period_min_us, period_max_us and error_us. Its error covers acquisition/quantization in device units; its period interval must hold over the requested samples. Stream/epoch ownership and hardware evidence are caller contracts, never inferred here.

Summary

Functions

at_device_time(estimate, arg2)

fit(probes, policy)

interval(estimate, anchor, index)