While the gPTP code seems to correctly work and keep the clock in sync, the calculation of residenceTime is not clear.
The time correction value is calculated as the newTime variable by peerSentTimeSync + peerDelay + correctionField + residenceTime. But why residenceTime is added at all?

While the gPTP code seems to correctly work and keep the clock in sync, the calculation of
residenceTimeis not clear.The time correction value is calculated as the newTime variable by
peerSentTimeSync + peerDelay + correctionField + residenceTime. But whyresidenceTimeis added at all?