How does Ubuntu synchronize time without ntp?

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?


Solution 1:

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

Solution 2:

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.

Solution 3:

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

Solution 4:

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.