When Ubuntu and Windows are installed on the same system, booting first into the one, setting correct time and then booting the other will show different time. This is caused by Windows using local time and setting the Real Time Clock (RTC) of the computer and Ubuntu is setting the RTC to Coordinated Universal Time (UTC (French: Temps Universel Coordonné)). Advice to fix this by using NTP is a little unsuccessful because that can take hours (time is not adjusted automatically in large steps) or fail (if the difference is out of tolerance for the time daemon.
Especially Windows client versions have since many versions problems with syncing to NTP servers - even when using Microsoft's own service.
Therefore, it's easier to fix the Ubuntu side (in Debian this is set by default):
timedatectl set-local-rtc 1
To check if it worked:
timedatectl Local time: Do 2023-02-16 21:01:40 CET Universal time: Do 2023-02-16 20:01:40 UTC RTC time: Do 2023-02-16 21:01:40 Time zone: Europe/Berlin (CET, +0100) System clock synchronized: yes NTP service: active RTC in local TZ: yes Warning: The system is configured to read the RTC time in the local time zone. This mode cannot be fully supported. It will create various problems with time zone changes and daylight saving time adjustments. The RTC time is never updated, it relies on external facilities to maintain it. If at all possible, use RTC in UTC by calling 'timedatectl set-local-rtc 0'.
Without explicit installation, Ubuntu does not install any NTP package.
It's using timesyncd (a systemd service) with its configuration in /etc/systemd/timesyncd.conf
.
By default, this service is using ntp.ubuntu.com
as fall back time server and has no primary set.
It's working without additional configuration. But, if a specific time server is required (or desired) set it in /etc/systemd/timesyncd.conf
.