On Sat, Apr 08, 2017 at 12:30:05AM +0200, Burkhard Ilsen wrote:

> diff --git a/tsproc.c b/tsproc.c
> index cf5f0dc..a9c1c48 100644
> --- a/tsproc.c
> +++ b/tsproc.c
> @@ -163,12 +163,17 @@ int tsproc_update_offset(struct tsproc *tsp, tmv_t 
> *offset, double *weight)
>  {
>       tmv_t delay, raw_delay = 0;
>  
> -     if (tmv_is_zero(tsp->t1) || tmv_is_zero(tsp->t2) ||
> -         tmv_is_zero(tsp->t3))
> +     if (tmv_is_zero(tsp->t1) || tmv_is_zero(tsp->t2))
>               return -1;
>  
> -     if (tsp->raw_mode || tsp->weighting)
> +     if (!tsp->raw_mode && tmv_is_zero(tsp->filtered_delay))
> +             return -1;
> +
> +     if (tsp->raw_mode || tsp->weighting) {
> +             if (tmv_is_zero(tsp->t3))
> +                     return -1;
>               raw_delay = get_raw_delay(tsp);
> +     }

As Miroslav pointed out, 'filtered_delay' can legitimately be zero.
Instead of testing for zero, we need a new flag.

Also, the new code tests for raw_mode, !raw_mode, and raw_mode again.
This is becoming unreadable, and I started hacking around to make it
somehow clearer.  I ended up with a whole new series which I'll post
as a RFC.

Thanks,
Richard

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to