Skip to content

Commit

Permalink
leap-a-day: Clear maxerror value to avoid STA_UNSYNC flag
Browse files Browse the repository at this point in the history
While the system runs, the maxerror value is always increasing
and if it crosses the phase limit, the STA_UNSYNC flag will
be set. This causes adjtimex to return TIME_ERROR/TIME_BAD.

Thus clear maxerror before running the test to avoid
STA_UNSYNC flag from getting set.

Signed-off-by: John Stultz <john.stultz@linaro.org>
  • Loading branch information
johnstultz-work committed Jan 24, 2015
1 parent 5feb2c9 commit be4526e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions leap-a-day.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ void clear_time_state(void)
tx.status = STA_PLL;
ret = adjtimex(&tx);

/* Clear maxerror, as it can cause UNSYNC to be set */
tx.modes = ADJ_MAXERROR;
tx.maxerror = 0;
ret = adjtimex(&tx);

/* Clear the status */
tx.modes = ADJ_STATUS;
tx.status = 0;
ret = adjtimex(&tx);
Expand Down

0 comments on commit be4526e

Please sign in to comment.