Commit 11c199bc authored by Alessandro Rubini's avatar Alessandro Rubini

WR: set system time from WR time

The previous code to set system time from WR time is not really
working.

It is implemented in wrs_time_ops->set and it relies on ppsi being
non-wr slave before being wr slave, but this should not happen.  Such
code, with its "weird" message, remains in place to be used when we
run in non-wr mode (as slaves).

This new code is the right thing to do: when we are done syncing the
"big steps" in WR, and start dealing with sub-tick, we jump system
time.

There is no correction for TAI/UTC because the time operations for
arch-unux (set/get) already do the conversion.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 832bd0d5
......@@ -359,6 +359,19 @@ int wr_servo_update(struct pp_instance *ppi)
s->flags |= WR_FLAG_WAIT_HW;
s->state = WR_WAIT_OFFSET_STABLE;
s->delta_ms_prev = s->delta_ms;
{
/*
* Now, let's fix system time. We pass here
* once only, so that's the best place to do
* it. We can't use current WR time, as we
* still miss the method to get it (through IPC).
* So use T4, which is a good approximation.
*/
unix_time_ops.set(ppi, &ppi->t4);
pp_diag(ppi, time, 1, "system time set to %li TAI\n",
(long)ppi->t4.seconds);
}
break;
case WR_WAIT_OFFSET_STABLE:
......
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