How to Set Up Time Synchronization on Debian

By
Sara Zivanov
Published:
December 11, 2025
Topics:

Time synchronization ensures the reliability, security, and functionality of Debian and other Unix-like systems. The Network Time Protocol (NTP) is an essential element for time sync that synchronizes the clocks of client computers with a time server.

This article explains how to set up time synchronization on Debian using ntpd and timesyncd.

Set up time synchronization on Debian

Prerequisites

  • Debian system (this tutorial uses Debian 11).
  • Command-line access.
  • Administrative access.

Setting up Time Sync on Debian

Correct time setting is essential for the proper functioning of modern software. Poor time synchronization across systems can lead to a range of issues, from simple errors to severe data corruption. The following sections explain how to set up time synchronization on Debian.

Step 1: Check Time on Debian

Check the time on the server with the date command:

date
date terminal output

The output shows the current time and date. The current time in the output is usually in Coordinated Universal Time (UTC). UTC is the time at zero degrees longitude and is accepted as a universal time zone.

Step 2: Set up Timezone

The date command prints the UTC zone by default. However, users sometimes need to change the timezone on Debian, which is done with the timedatectl command. Take the following steps to change the timezone on Debian:

1. List the available timezones on Debian:

timedatectl list-timezones
Listing timezones in Debian.

The command prints a list of all the available time zones. 

2. Navigate the output with the Spacebar and b key. 

3. Choose the time zone. For example, US/Eastern.

Choosing a US/Eastern timezone.

Press q to exit the list.

4. Change the timezone with the following command:

sudo timedatectl set-timezone <timezone>

For example, to change the timezone to US/Eastern run:

sudo timedatectl set-timezone US/Eastern

The command shows no output

5. Verify the change with date:

date
Changing the timezone.

The output shows the EDT time, the abbreviation for Eastern Daylight Time in the US and Canada. 

Step 3: Check The Status of ntpd

Debian runs the standard Network Time Protocol daemon (ntpd) to sync the system time with external time servers. While NTP is the protocol for synchronizing time, ntpd is the program that implements the NTP protocol.

To confirm ntpd is running, execute the systemctl command:

sudo systemctl status ntp
Output for sudo systemctl status ntp

The output shows the ntpd service is active. Therefore, ntpd is running and in sync with a time server.

However, the ntpq command provides additional information about the ntpd status:

ntpq -p
Output for ntpg -p

The ntpq command is an ntpd query tool. The -p argument specifies info about the NTP servers to which ntpd currently connects.

Switching from ntpd to timesyncd

Timesyncd is a lightweight ntpd alternative, which is simpler to configure, more efficient, and more secure. Furthermore, timesyncd also integrates better with systemd. This feature makes it easy to manage using the systemd commands.

However, timesyncd cannot be used as a time server, and it is less sophisticated in keeping the system time in sync. These features make the program less suitable for systems that require accuracy and reliability. Complex real-time distributed systems generally work better with ntpd.

Follow the steps to set up timesyncd:

1. Uninstall ntpd:

sudo apt purge ntp
Output for sudo apt purge

2. If the timesyncd is not on the system, run the following to install it:

sudo apt install systemd-timesyncd
Terminal output for sudo apt install systemd timesyncd

3. Start the timesyncd service:

sudo systemctl start systemd-timesyncd

The command has no output.

4. Check the status:

sudo systemctl status systemd-timesyncd
Output for sudo systemctl status systemd-timesyncd

The output confirms timesyncd is running. To display the current time and date, run:

timedatectl
Output for timedatectl

The output prints info such as:

  • Local time.
  • Universal time.
  • System real-time clock (RTC) time.
  • Timezone.
  • Confirmation the system clock is synchronized.

Note: Using ntpd instead of timesyncd does not change the process of checking the date and time, or changing time zones. The commands are the same, regardless of which NTP daemon is used.

Conclusion

After reading this text, you now know how to set up time synchronization on Debian with ntpd and timesyncd.

Next, learn how to get the current date and time in Python or how to use JavaScript to get the current date and time.

Was this article helpful?
YesNo