By clicking "System settings -> Time & Date -> Automatically from the Internet" I can synchronize time from the Internet.
However, I find that I don't have a ntpd
daemon (It's not even installed). So how does the synchronization work?
This is done by synchronizing with ntpdate
tool.
man ntpdate
NAME
ntpdate - set the date and time via NTP
ntpdate sets the local date and time by polling the Network Time Proto‐
col (NTP) server(s) given as the server arguments to determine the cor‐
rect time. It must be run as root on the local host (unless the option
-q is used). A number of samples are obtained from each of the servers
specified and a subset of the NTP clock filter and selection algorithms
are applied to select the best of these. Note that the accuracy and
reliability of ntpdate depends on the number of servers, the number of
polls each time it is run and the interval between runs.
ntpdate can be run manually as necessary to set the host clock, or it
can be run from the host startup script to set the clock at boot time.
This is useful in some cases to set the clock initially before starting
the NTP daemon ntpd. It is also possible to run ntpdate from a cron
script. However, it is important to note that ntpdate with contrived
cron scripts is no substitute for the NTP daemon, which uses sophisti‐
cated algorithms to maximize accuracy and reliability while minimizing
resource use. Finally, since ntpdate does not discipline the host clock
frequency as does ntpd, the accuracy using ntpdate is limited.
You can do so with
sudo ntpdate TIME-SERVER
TIME-SERVER lists can be founded here
Ubuntu synchronises with the ntpdate
utility once each time the network connection comes up (which usually happens when you boot).
This utility is installed by default, but only runs when Ubuntu calls it and does not stay running in the background as a daemon.
Installing the ntp
package installs the NTP daemon. The ntp daemon allows for the time to be continually synchronised while the system is running.
Update: in recent versions of Ubuntu (eg 16.04) ntpdate
is replaced by timedatectl
, which synchonises once on boot as well as when a network comes up, but does not keep running at other times. See https://help.ubuntu.com/lts/serverguide/NTP.html for more.
dpkg-query --listfiles ntpdate
to /etc/network/if-up.d/ntpdate
.
timedatectl
which works similarly - it's installed by default and synchronises once on boot, but also when a network comes up.
Mar 1, 2017 at 3:59
For those of you with 16.04 LTS time sync appears to be handled by sytemd specifically "timedatectl"
timedatectl status
Local time: Wed 2016-11-30 17:45:18 CST
Universal time: Wed 2016-11-30 23:45:18 UTC
RTC time: Sun 2016-12-04 06:50:39
Time zone: America/Chicago (CST, -0600)
Network time on: yes
NTP synchronized: yes
RTC in local TZ: no
Config is
/etc/systemd/timesyncd.conf
More info here: Time Synchronisation with NTP AND timedatectl
Note also that it is entirely possible for there to be a front-end interface, to a service which is not installed.
You can change the settings in that front-end (GUI) interface all you want, but if the service that actually performs the tasks isn't installed, nothing will happen.
Note however, that I think the "switch" is valid because it tells it to do the one-time update at EACH boot. (or to not do so).
Unless this is a not-network connected system, or there is some other overriding reason to NOT have its time set to match "standard" time, I would strongly urge you to install ntpd, and properly configure and run it.
Refer to: https://help.ubuntu.com/community/UbuntuTime
Ubuntu comes with ntpdate as standard, and will run it once at boot time to set up your time according to Ubuntu's NTP server. However, a system's clock is likely to drift considerably between reboots if the time between reboots is long. In that case it makes sense to correct the time occasionally. The easiest way to do this is to get cron to run it every day.
ntpdate ntp.ubuntu.com
ntpd
(help.ubuntu.com/lts/serverguide/NTP.html#ntpd) to maintain synchronization.
For some reason, on 16.04, Maythux's answer doesn't work straight away.
But taking the lead from there, this worked for me.
$ sudo ntpdate-debian
Please note that it requires sudo
privilege, obviously.
Under the hood, it uses ntpdate
tool, differing only the config file.
ntpdate-debian
is identical tontpdate(8)
except that it uses the configuration in/etc/default/ntpdate
by default. ntpdate sets the local date and time by polling Network Time Protocol (NTP) servers.
sudo ntpdate-debian
does the same assudo ntpdate ntp.ubuntu.com
. The strange is why did they picked and tweaked this package from debian when we read itis identical to ntpdate(8) except that it uses the configuration in /etc/default/ntpdate by default
and catting this file we readNTPDATE_USE_NTP_CONF=yes # List of NTP servers to use (Separate multiple servers with spaces.) # Not used if NTPDATE_USE_NTP_CONF is yes. NTPSERVERS="ntp.ubuntu.com"
???
Well the later Ubuntu releases often do it using chrony which is an alternative implementation of ntp with some differences:-
See https://chrony.tuxfamily.org/ for more information.
ntpdate
, --- you have to manually installntp
for having continouos time sync with the internet. I reported it in bugs.launchpad.net/ubuntu/+source/gnome-control-center/+bug/…Automatically from the Internet
option or anything related.