On 11/29/2020 7:50 PM, Richard Cochran wrote:
> When using a PPS time source with the -w flag, the program closes the PMC
> agent's connection once the ptp4l service has appeared and the UTC offset
> has been optionally queried.
> 
> In order to tell whether PPS is the time source, the code tests for
> 
>     src->clkid == CLOCK_INVALID
> 
> which is completely opaque and non-obvious.  Presently only the case where
> src_name is NULL (and pps_fd is valid) will trigger this test, but that is
> only incidental.
> 
> Clarify the intention of the code by using a proper test.
> 
> Signed-off-by: Richard Cochran <richardcoch...@gmail.com>

Significant improvement here, it is a bit more clear what's going on
here now.

Reviewed-by: Jacob Keller <jacob.e.kel...@intel.com>

Thanks,
Jake

> ---
>  phc2sys.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/phc2sys.c b/phc2sys.c
> index e65bdf5..15ccb80 100644
> --- a/phc2sys.c
> +++ b/phc2sys.c
> @@ -1328,7 +1328,7 @@ int main(int argc, char *argv[])
>  
>               if (priv.forced_sync_offset ||
>                   (src->clkid != CLOCK_REALTIME && dst->clkid != 
> CLOCK_REALTIME) ||
> -                 src->clkid == CLOCK_INVALID) {
> +                 hardpps_configured(pps_fd)) {
>                       pmc_agent_disable(priv.agent);
>               }
>       }
> 


_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to