通过单击“系统设置 -> 时间和日期 -> 自动从 Internet”,我可以从 Internet 同步时间。
但是,我发现我没有ntpd守护进程(甚至没有安装)。那么同步是如何工作的呢?
May*_*hux 37
这是通过与ntpdate工具同步来完成的 。
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.
Run Code Online (Sandbox Code Playgroud)
你可以这样做
sudo ntpdate TIME-SERVER
Run Code Online (Sandbox Code Playgroud)
时间服务器列表可以在这里找到
tho*_*ter 21
ntpdate每次网络连接出现时,Ubuntu 都会与该实用程序同步一次(通常在您启动时发生)。
该实用程序默认安装,但仅在 Ubuntu 调用它时运行,并且不会作为守护程序在后台运行。
安装ntp软件包会安装 NTP 守护程序。ntp 守护进程允许在系统运行时持续同步时间。
更新:在最新版本的 Ubuntu(例如 16.04)中ntpdate被替换timedatectl,它在启动时和网络出现时同步一次,但在其他时间不会继续运行。有关更多信息,请参阅https://help.ubuntu.com/lts/serverguide/NTP.html。
Mys*_*jin 16
对于那些使用 16.04 LTS 时间同步的人来说,似乎由 sytemd 专门处理“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
Run Code Online (Sandbox Code Playgroud)
配置是
/etc/systemd/timesyncd.conf
Run Code Online (Sandbox Code Playgroud)
更多信息:时间同步与 NTP 和timedatectl