在 Ubuntu 系统中同步时间戳(系统时间)通常有两种常见方式:使用 systemd-timesyncd(推荐) 和 使用 ntp/chrony。下面按常见场景说明。
Ubuntu 16.04 及以后版本默认使用 systemd-timesyncd 进行时间同步。
timedatectl status
正常输出中应包含:
System clock synchronized: yes
NTP service: active
sudo timedatectl set-ntp true
如果未启动:
sudo systemctl enable systemd-timesyncd
sudo systemctl start systemd-timesyncd
sudo systemctl restart systemd-timesyncd
journalctl -u systemd-timesyncd
sudo apt update
sudo apt install ntp
sudo systemctl enable ntp
sudo systemctl start ntp
sudo ntpdate -u pool.ntp.org
sudo apt install chrony
sudo systemctl enable chrony
sudo systemctl start chrony
chronyc tracking
chronyc sources
sudo date -s "2026-01-21 15:30:00"
sudo hwclock --systohc
chrony 效果更好timedatectl list-timezones
sudo timedatectl set-timezone Asia/Shanghai
timedatectl set-ntp false
sudo ntpdate pool.ntp.org
sudo timedatectl set-ntp true
timedatectl status
date
如果你能说明:
我可以给你更精确的同步方案。