Minimal IEEE-1588v2 (PTP) grandmaster for AirPlay 2 — the timing gate for
HomePods. HomePods negotiate timingProtocol:"PTP" and schedule
playback against a PTP network clock; we advertise ourselves as the grandmaster
so the receiver slaves to our clock, then SETRATEANCHORTIME references a real
time on this clock.
Runs on PTP multicast 224.0.1.129: general msgs (Announce, Follow_Up,
Delay_Resp) on udp/320, event msgs (Sync) on udp/319; answers the receiver's
Delay_Req. clock_identity/0 (8 bytes) ↔ timeline_id/0 (its u64) is what goes
in the anchor's networkTimeTimelineID. now/0 returns {secs, nanos} on our
clock; anchor_time/1 gives {secs, frac64} for the anchor a bit in the future.
Summary
Functions
Anchor time offset_ms in the future as {secs, frac64} (frac = fraction*2^64).
Returns a specification to start this module under a supervisor.
Current PTP clock as {seconds, nanoseconds}.
Start the grandmaster (idempotent-ish; one per node).
Functions
Anchor time offset_ms in the future as {secs, frac64} (frac = fraction*2^64).
Returns a specification to start this module under a supervisor.
See Supervisor.
Current PTP clock as {seconds, nanoseconds}.
Start the grandmaster (idempotent-ish; one per node).