A method, comprising: configuring, by one or more processors, a plurality of devices (110, 120) in a network for clock synchronization according to a primary spanning tree (200, 600), wherein the primary spanning tree (200, 600) has a plurality of nodes connected through a plurality of primary links (230, 240, 242, 244, 622), each node of the plurality of nodes representing a respective device of the plurality of devices; computing, by the one or more processors, a backup spanning tree (400, 500, 700) before a failure is detected in the primary spanning tree (200, 600), wherein the backup spanning tree (400, 500, 700) includes one or more backup links (410, 420, 510, 520, 530, 540, 670, 680, 690) that are different from the primary links (230, 240, 242, 244, 622); upon detection of a failure in the primary spanning tree (200, 600), reconfiguring, by the one or more processors, the plurality of devices such that clock synchronization is performed according to the backup spanning tree (400, 500, 700); characterized by the additional steps of: receiving, at a given node, a first synchronization message from a primary parent node of the given node; detecting, based on a mismatch between a first timestamp in the first synchronization message and a first local clock value of the given node meeting a predetermined threshold, a byzantine failure; after being reconfigured according to the backup spanning tree (400, 500, 700), receiving, at the given node, a second synchronization message from a backup parent node of the given node; and detecting, based on a mismatch between a second timestamp in the second synchronization message and a second local clock value of the given node whether the byzantine failure occurred at the given node or at the primary parent node, wherein: when the mismatch meets the predetermined threshold, the byzantine failure occurred at the given node; and when the mismatch does not meet the predetermined threshold, the byzantine failure occurred at the primary parent node. configuring, by one or more processors, a plurality of devices (110, 120) in a network for clock synchronization according to a primary spanning tree (200, 600), wherein the primary spanning tree (200, 600) has a plurality of nodes connected through a plurality of primary links (230, 240, 242, 244, 622), each node of the plurality of nodes representing a respective device of the plurality of devices; computing, by the one or more processors, a backup spanning tree (400, 500, 700) before a failure is detected in the primary spanning tree (200, 600), wherein the backup spanning tree (400, 500, 700) includes one or more backup links (410, 420, 510, 520, 530, 540, 670, 680, 690) that are different from the primary links (230, 240, 242, 244, 622); upon detection of a failure in the primary spanning tree (200, 600), reconfiguring, by the one or more processors, the plurality of devices such that clock synchronization is performed according to the backup spanning tree (400, 500, 700); characterized by the additional steps of: receiving, at a given node, a first synchronization message from a primary parent node of the given node; detecting, based on a mismatch between a first timestamp in the first synchronization message and a first local clock value of the given node meeting a predetermined threshold, a byzantine failure; after being reconfigured according to the backup spanning tree (400, 500, 700), receiving, at the given node, a second synchronization message from a backup parent node of the given node; and detecting, based on a mismatch between a second timestamp in the second synchronization message and a second local clock value of the given node whether the byzantine failure occurred at the given node or at the primary parent node, wherein: when the mismatch meets the predetermined threshold, the byzantine failure occurred at the given node; and when the mismatch does not meet the predetermined threshold, the byzantine failure occurred at the primary parent node. receiving, at a given node, a first synchronization message from a primary parent node of the given node; detecting, based on a mismatch between a first timestamp in the first synchronization message and a first local clock value of the given node meeting a predetermined threshold, a byzantine failure; after being reconfigured according to the backup spanning tree (400, 500, 700), receiving, at the given node, a second synchronization message from a backup parent node of the given node; and detecting, based on a mismatch between a second timestamp in the second synchronization message and a second local clock value of the given node whether the byzantine failure occurred at the given node or at the primary parent node, wherein: when the mismatch meets the predetermined threshold, the byzantine failure occurred at the given node; and when the mismatch does not meet the predetermined threshold, the byzantine failure occurred at the primary parent node. when the mismatch meets the predetermined threshold, the byzantine failure occurred at the given node; and when the mismatch does not meet the predetermined threshold, the byzantine failure occurred at the primary parent node.