Commit 1b91e320 authored by Tomasz Wlostowski's avatar Tomasz Wlostowski Committed by Grzegorz Daniluk

lib/net.c: fixed jump in linearize_rx_timestamp() when phase == transition_point.

After subtraction of transition value from linearized phase, the phase value was renormalized to 0...clock_period-1, but
not the other counters. This resulted in very rare 8ns jumps.
parent 0a8739ed
......@@ -167,9 +167,20 @@ void ptpd_netif_linearize_rx_timestamp(wr_timestamp_t * ts, int32_t dmtd_phase,
}
ts->phase = phase - transition_point - 1;
if (ts->phase < 0)
ts->phase = phase - transition_point;
/* normalize timestamp after subtraction */
if(ts->phase < 0)
{
ts->phase += clock_period;
ts->nsec -= clock_period / 1000;
}
if(ts->nsec < 0)
{
ts->nsec += 1000000000;
ts->sec--;
}
}
/* Slow, but we don't care much... */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment