Add a new option to wait for ptp4l to be in a synchronized state.
Periodically check PORT_DATA_SET and wait until there is a port in
SLAVE, MASTER or GRAND_MASTER state. Also, set the default
synchronization offset according to the currentUtcOffset value from
TIME_PROPERTIES_DATA_SET and the direction of the clock synchronization.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
The PPS time stamps are always made by the system clock, don't allow
running the PPS loop with other clocks.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
In the PPS loop, instead of setting the system clock from the PHC only
once on start, read PHC with each PPS sample and use the time stamp to
get the whole number of seconds in the offset. This will prevent phc2sys
from losing track of the system clock.
Also, check if the PPS is synchronized to the PHC.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>