If you have configured a Network Time Protocol client on your Linux host, but for whatever reason it is not updating then this process might help. If you haven’t configured NTPd on your system yet, check out this write up on Configuring NTP on a Linux Client.
There are two values that the client uses to determine a polling frequency, those are minpoll and maxpoll and can be found in /etc/ntp.conf. You can adjust ntpd to increase or decrease the polling frequence, however the default values should be sufficient in most cases.
The Network Time Protocol Daemon is supposed to update fairly quickly when the service is restarted, but sometimes that doesn’t always work. Instead of waiting around for the default settings to update the clock slowly, you can manually force the time to sync with reality using this simple set of commands:
sudo service ntp stop sudo ntpd -gq sudo service ntp start
The -g option is to override the built in sanity check of 1000s. Normally if the system time is over 1000s off from the configured server time, the ntpd process will quit.
The -q option will exit the ntpd process after the clock is set.
Combined, these two options tell ntpd to start, get the time, ignore the offset even if it is greater than the default 1000 second sanity check, then exit. There are a ton of other options under the ntpd command, check out the man page for a full list.
NTP Command Example
Here is some sample output from the CLI:
[email protected]:~$ date Fri Oct 30 21:09:38 MST 2017 [email protected]:~$ sudo service ntp stop * Stopping NTP server ntpd ...done. [email protected]:~$ sudo ntpd -gq ntpd: time set +70260.809371s [email protected]:~$ date Sat Oct 31 16:41:13 MST 2017 [email protected]:~$ sudo service ntp start [sudo] password for admin: * Starting NTP server ntpd ...done. [email protected]:~$ ntpq ntpq> as ind assid status conf reach auth condition last_event cnt =========================================================== 1 8848 963a yes yes none sys.peer sys_peer 3 ntpq> pe remote refid st t when poll reach delay offset jitter ============================================================================== ntp.box.local 220.127.116.11 3 u 6 64 1 0.598 -0.015 0.000
This is a fairly simple procedure to get things back on track if for any number of reasons your Linux system time drifts too far off from reality and can’t fix itself. If you have another method to get this done or have any suggestions to improve on these steps, please comment below.