Ntpd is only used by the client, the time update interval?

When ntpd is only used as a client, how long does it take to synchronize the system time with the ntp server? Is it only synchronized once at startup? Can this synchronization interval be modified?

varies depending on network availability and server response time

no

not via command parameters... it can be done with cron or similar single invokations...

########## ntpd --help 2>&1 | grep PROG; ps wwww | grep ntpd
Usage: ntpd [-dnqNwl] [-I IFACE] [-S PROG] [-p PEER]...
	-S PROG	Run PROG after stepping time, stratum change, and every 11 min
16555 root      1216 S<   /usr/sbin/ntpd -n -N -l -S /usr/sbin/ntpd-hotplug -p SERVER1 -p SERVER2 ...
########## cat /etc/init.d/sysntpd | grep interface_trigger
				procd_add_interface_trigger "interface.*" $n /etc/init.d/$name reload
		procd_add_interface_trigger "interface.*" "$ifname" \

1 Like

My previous description may not be accurate enough, I think the problem is the synchronization interval between openwrt ntpd and ntp server. In my daily use, I find that ntpd will synchronize the time with the server only when the system is started, and then it will not synchronize again. This will cause the time to be inaccurate. If this is the case, then you have to do a scheduled task to achieve timing synchronization.

please provide some evidence supporting this...

your definition/interpretation of synchronization seems rather binary... suggest you do some search on the forum and elsewhere for "offset stratum change" or similar...

1 Like

I am not sure that he must not be running, but I am also not sure that he has been running repeatedly at intervals, because there is no relevant running information recorded in the log, and the running time of the machine is obviously wrong. If it runs normally, the time will at least be accurate. of.

How much off is the clock?
Is it possible the time shifts that much during a 24h window, assuming ntpd resyncs every day.

/usr/sbin/ntpd -n -N -S /usr/sbin/ntpd-hotplug -p ntp..

Only the above process is running in the system. I checked the official information and did not introduce whether this process will be synchronized for a period of time. How long is the interval?

covered already... did you readup as advised?

what's the drift like?

1 Like

-S PROG Run PROG after stepping time, stratum change, and every 11 mins

Is this 11-minute period based on the -S parameter of ntpd? I have always understood that the parameters specified by -S are executed at an interval of 11 minutes instead of 11 minutes of synchronization. Could it be that the script /usr/sbin/ntpd-hotplug contains the synchronization code, which indirectly realizes the 11-minute synchronization?

no... 'synchronization' as you call it is a function of the busybox ntpd code depandant on protocol characteristics... (which you really need to devote some time into reading about)

-S if you look at ntpd --help simply defines a script to run when events occur... in this case triggering userspace hotplug handling

if there was an issue as you describe it... i'm pretty sure several of the thousands of users would have noted the anomalies by now...

this implies either;

  • you are making false assumptions
  • you have setup something (probably time setting related) unknown to us that is impeding ntpd
  • your servers are custom and don't talk properly
  • you have another underlying network issue that is impeding protocol function
1 Like

It is better to disable ntpd and use crontab to implement it, or use ntpclient to implement it directly. Now I just don't want to install too many applications, so I want to solve it in the existing environment as much as possible.

to solve something... you must define and demonstrate what you are solving...

we still have no idea what is actually going on... for all we know... it's user false assumption and there is nothing to fix at all...

2 Likes

There is a language barrier here, so neither of us can explain the problem clearly.

The “11 min function” is a universal all system unix kernel thing programmed at kernel compilation to sync RTC in linux time systems. Once compiled you can’t turn it on or off.
But you probably don’t have a RTC on your router.

My general experience with ntp systems when playing around to make my own network strantum server is that the synk time is a floating target. At the beginning there are some fast syncs and then it will expand sync time and land on max sync time (for example about 30min). Unless the system is set as a one time shot, but one time synk and then sleep is something you have done in config file.

The only real thing that can scramble the process is if your equipment is offline, then the system clock will drift more or less.
But if you are online or have connection to whatever ntp server you like these ntp system are very stable.

So, can we see your system config file to begin with? If of course you are online to begin with!?

1 Like
opkg update
opkg install tcpdump
tcpdump -evni any udp port 123
1 Like
echo "logger -t ntpdebug \"\$1 \$(env | grep -E '(^offset|^stratum|^poll|^freq)')\"" >> /usr/sbin/ntpd-hotplug
1 Like

There is no problem with the update time of the network and ntpd itself. The problem here is: ntpd does not get the server time information at an interval; if there is, how long is the interval?

This method can be tried

The polling interval used by the busybox ntpd is between 32 and 4096 seconds. It's adjusted automatically depending on the stability of the clock and network.

Please don't start an NTP client from cron. Many people do that. It creates massive spikes in network load on public servers.

1 Like

It's you who's having problems, not wulfy23 ,)