Home > Resources > Qanda > How Does BMCA (Best Master Clock Algorithm) Work in IEEE 1588 PTP?
How Does BMCA (Best Master Clock Algorithm) Work in IEEE 1588 PTP?
Q: What is the Best Master Clock Algorithm (BMCA)?
A: The Best Master Clock Algorithm (BMCA) is the mechanism defined in the IEEE 1588 Precision Time Protocol (PTP) that automatically determines which clock on a network should serve as the Grandmaster (GM) — the authoritative time source from which all other clocks synchronize. BMCA runs independently on every PTP device, and each port compares the attributes of its own clock against announcements received from neighboring clocks. Through this distributed comparison, all devices independently reach the same conclusion about which clock is best, without requiring a centralized controller.
Q: How does the comparison process work?
A: When a PTP device receives an Announce message from a neighbor, BMCA compares a ranked set of attributes to decide which clock is superior. The comparison follows a strict priority order:
clockClass — highest priority in comparison
clockAccuracy
offsetScaledLogVariance (stability)
priority1
clockIdentity
priority2
Port address / sequence
The first attribute that differs determines the winner. The losing clock's port transitions to a Slave (or Passive) state relative to the winner.
Q: What is clockClass and why does it matter?
A:clockClass is an integer value (0–255) that indicates the quality and traceability of a clock's time source. Lower values represent better quality. Key ranges include:
6 — Locked to a primary reference (e.g., GPS-disciplined clock)
7 — Not locked but within holdover specification
13 — Locked to an application-specific source
248 — Default, unsynchronized or degraded
255 — Slave-only clock (never to be chosen as GM)
Because clockClass is the first comparison attribute, a GPS-locked clock (class 6) will always outrank a locally free-running clock (class 248), regardless of other settings.
Q: What are priority1 and priority2?
A:Priority1 and priority2 are user-configurable values (0–255) that give administrators manual control over GM selection.
priority1 is compared before clockIdentity. A lower value means higher priority. Setting priority1 to 0 on a preferred clock strongly encourages it to become the GM.
priority2 is compared last among the standard attributes, used as a final tiebreaker among clocks that are otherwise identical in quality. For example, if two identical redundant clocks exist, priority2 distinguishes which one is preferred.
Setting priority1 = 255 effectively excludes a clock from ever becoming the Grandmaster.
Q: Summary
A: BMCA ensures robust, automatic, and deterministic GM selection. clockClass governs time-source quality, priority1 provides strong administrative preference, and priority2 offers fine-grained tiebreaking — together giving engineers full control over PTP grandmaster topology.