It is recommended to synchronize the clock with the Internet in accordance with the specified time zone, if there is no need to manually change the system time. This article describes how to synchronize your clock with Internet time servers using the command line and graphical user interface of Debian 10. This tool was originally developed for older computers that could not keep up with the current time.
We ran the commands and procedures mentioned in this article on the Debian 10 Buster system.
Synchronizing the system clock via the command line
Check current time
The timedatectl command allows you to check the current time of your system clock. Open a Debian terminal through the Application Launch Search as follows:
Then run the following command:
$ timedatectl status
Among other things, you can see local time, universal time, and also whether your system clock is synchronized with Internet time servers or not.
Synchronize system time
The chronyd command allows you to check the system clock shutdown time. If you run the chronyd command without first installing the utility, you will receive the following message:
First, let’s set it like this:
$ sudo apt-get install chrony
If your time has not already been synchronized, like mine, you will notice that the utility immediately synchronizes the time immediately after installation.
Here’s how Chrony can help you:
- Then you can use the following command to see how much your time is different from the Internet server. The line “System clock is incorrect” in the output indicates this.
$ sudo chronyd -Q
- You can also synchronize the system time and see the information “System clock is incorrect” in one command:
$ sudo chronyd -q
In the following example, you can see that when I first ran the chronyd -q command, my system was shut down for 103.43 seconds. After executing the command, my time on the Internet was reset, and this can be observed when I restarted the command. This time my system clock is only off for 0.001331 seconds, which is a minor difference.
System clock synchronization via graphical interface
Operating systems these days are configured to automatically download the date, time, and time zones over the Internet. You can configure your system to select the date and time according to the selected time zone as follows:
Click the down arrow located in the upper right corner of the Debian desktop, and then click the settings icon located in the lower left corner:
Enter Settings in the application search window as follows:
Click the Details tab and select the Date and Time option. Click the “Unblock” button in the “Date and Time” view and enter the password for the sudo / authorized user in the authentication dialog box.
Then make sure the “Auto Date and Time” button is turned on. This will allow you to automatically receive the current date and time from the Internet server.
Important: In Debian, you can turn on / off the automatic date and time only when the Chrony utility is uninstalled first. You can do this by running the following command in Terminal:
$ sudo apt-get remove chrony
By following the steps described in this guide, you can be 100 percent sure that the current time of your system is synchronized with the current time of your Internet time server.
How to synchronize system time with internet time servers in Debian 10