2

I'm trying to figure out how ntpd (from busybox) works. I'm running the following scenario, for a test sake:

  1. set up date/time, using date -s, to any arbitrary date/time (e.g. 2000-01-01 00:00:00);
  2. run the command ntpd -N -p <server_address> to start the daemon. Just after that, the date/time is successfully sync;
  3. change the date/time againt, using date -s, to the same used in the 1st step (i.e. 2000-01-01 00:00:00);

After that, I have been expecting that date/time was synchronized again, but this doesn't occur, even if I wait for a couple of hours.

My question is: my comprehension about the ntpd's behavior is correct? Should the date/time be resync automatically after the 3rd step? If not, what should I do to resync the date/time?

Valmir
  • 401
  • 1
  • 5
  • 14
  • That's outside of the allowed correction window of 1000 sec (From memory). Try a smaller change and see if that behaves as expected. The 1st sync is prob called with the `-g` or equivalent flag but then ntp expects to keep the clock in check within 500PPM hence no 3rd correction. – user3788685 Mar 13 '18 at 20:31
  • @user3788685 I'd tried a smaller change (about 5min) and I've waited for a couple of hours again, but the time wasn't resynced. – Valmir Mar 14 '18 at 19:51
  • Can you show the output from `ntpq -pcrv` presuming the busybox version supports that full command. We need to see the state of ntp while its running normal, and once you change the time. – user3788685 Mar 15 '18 at 21:12
  • @user3788685 Unfortunately my embedded system doesn't support this call. – Valmir Mar 20 '18 at 14:15

1 Answers1

1

I would check internaly in the trimmed busybox implementation if the use case is actually covered. Some options could be actually ignored and that can cause confusion.

If not, in case it is a yocto based embedded system, you should consider bring the actual and complete ntpd instead of the busybox one.

urnenfeld
  • 1,030
  • 9
  • 25