Oct 21, 2023 9 min read

How To Configure Time Synchronization on Ubuntu 20.04

Configure Time Synchronization on Ubuntu 20.04 with our step-by-step tutorial. It aligns clocks to a common reference time.

How To Configure Time Synchronization on Ubuntu 20.04
Configure Time Synchronization on Ubuntu 20.04
Table of Contents


Before we begin talking about how to configure Time Synchronization on Ubuntu 20.04, let’s briefly understand – What is Time Synchronization?

Time synchronization aligns clocks to a common reference time. It ensures accurate and consistent timekeeping across various systems, such as networks, servers, and devices.

Time synchronization plays a crucial role in applications where time accuracy is vital, like financial transactions, data logging, and communication systems. By synchronizing time, errors and inconsistencies can be minimized, resulting in improved efficiency and reliability. Explore more on why time synchronization is essential and how it works.

In this tutorial, you will configure Time Synchronization in an independent environment on Ubuntu 20.04. We will also address a few FAQs on how to configure Time Synchronization on Ubuntu 20.04.

Advantages of Time Synchronization

  1. Accuracy: Time synchronization ensures precise alignment of clocks, preventing discrepancies and improving reliability.
  2. Coordination: Synchronized time allows devices to work together seamlessly, enabling efficient communication and collaboration.
  3. Data Integrity: Accurate timestamps facilitate proper data logging, analysis, and troubleshooting, ensuring integrity and auditability.
  4. Security: Time synchronization is vital for secure authentication, encryption, and digital signatures, reducing vulnerabilities and ensuring trusted transactions.
  5. Compliance: Many industries have regulatory requirements for accurate timekeeping, making synchronization essential for legal compliance and avoiding penalties.


You will require an Ubuntu 20.04 server with a non-root, sudo-enabled user and a firewall before beginning this tutorial, as specified in this tutorial on setting up an Ubuntu 20.04 server.

You will use the command date to view the time on your server. To print the date and time, any user can execute the following command:


Typically, your server will produce an output using the UTC time zone as the default.

Thu Aug 5 15:55:20 UTC 2021

Coordinated Universal Time, or UTC, is the time at latitude 0°. Using Universal Time helps to avoid confusion when your infrastructure covers many time zones, even though this may not match your current time zone.

However, you can use the timedatectl command to modify your time zone.

Run the following command to create a list of the available time zones first:

timedatectl list-timezones

Your computer screen will display a list of time zones. You can page up by pressing b, and down by pressing SPACE. Once you've found the right time zone, note it down and then press q to leave the list.

The time zone can then be changed by substituting the highlighted area with the time zone you discovered in the list when using timedatectl set-timezone. To make this modification, you'll need to use sudo and timedatectl:

sudo timedatectl set-timezone America/New_York

By running the date again, you can confirm your modifications:

Thu Aug 5 11:56:01 EDT 2021

The newly selected value will be reflected in the time zone abbreviation.

You may ensure that your time is correctly synchronized in the following section after practising checking the time and configuring time zones.

Controlling timesyncd with timedatectl

The Network Time Protocol daemon, or ntpd, used to handle the majority of network time synchronization. This service links to a network of additional NTP servers, that provide it regular, precise time updates.

You can now use timesyncd instead of ntpd with Ubuntu's default installation, though. Similar to timesyncd, which connects to the same time-servers, systemd is more tightly integrated with timesyncd on Ubuntu.

timedatectl can be used to check the status of timesyncd without any parameters. In this situation, sudo is not required:


                     Local time: Thu 2021-08-05 11:56:40 EDT
           Universal time: Thu 2021-08-05 15:56:40 UTC
                 RTC time: Thu 2021-08-05 15:56:41
                Time zone: America/New_York (EDT, -0400)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

If you didn't switch from the UTC time zone, the universal time may be the same as local time. This program also displays out some network time status data. System clock synchronized: yes indicates that the time has been successfully synchronized, and NTP service: active implies timesyncd is up and running.

Use timedatectl to activate the NTP service if your output indicates that it isn't running:

sudo timedatectl set-ntp on

Run timedatectl once more to verify the network time status after that. System clock synchronized: will read yes and NTP service: will display as active after the sync, which could take a minute.

Switching to ntpd

In most situations, timesyncd will function. There are, however, some circumstances when an application might be sensitive to any change over time. ntpd is a different network time service that you can utilize in this situation. The system time is continuously and gradually maintained by ntpd using complex algorithms.

You must disable timesyncd prior to installing ntpd in order to avoid conflicts between the two services. This can be achieved by turning off network time synchronization with the command:

sudo timedatectl set-ntp no

Check to see if time synchronization is turned off:


Verify that NTP service: inactive is displayed in your output. This indicates that timesyncd has terminated. You are now prepared to use apt to install the ntp package.

Run apt update to update your local package index first:

sudo apt update

After that, launch apt install ntp to set up the package:

sudo apt install ntp

Following the completion of your installation, ntpd will launch automatically. By asking ntpd for status information, you can make sure everything is operating as intended:

ntpq -p
          remote           refid      st t when poll reach   delay   offset  jitter
 0.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 1.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 2.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 3.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 ntp.ubuntu.com  .POOL.          16 p    -   64    0    0.000    0.000   0.000
+t1.time.bf1.yah      2 u   16   64    1   61.766  -20.068   1.964
+puppet.kenyonra      3 u   16   64    1    2.622  -18.407   2.407
*ntp3.your.org   .GPS.            1 u   15   64    1   50.303  -17.499   2.708
+time.cloudflare       3 u   15   64    1    1.488  -18.295   2.670
+mis.wci.com  2 u   15   64    1   21.527  -18.377   2.414
+ipv4.ntp1.rbaum     2 u   12   64    1   49.741  -17.897   3.417
+time.cloudflare       3 u   15   64    1    1.039  -16.692   3.378
+      2 u   14   64    1   70.060  -16.993   3.363
+ny-time.gofile.      2 u   21   64    1   75.349  -18.333   2.763
 golem.canonical    2 u   28   64    1  134.482  -21.655   0.000
 ntp3.junkemailf  2 u   19   64    1    2.632  -16.330   4.387
 clock.xmission. .XMIS.           1 u   18   64    1   24.927  -16.712   3.415
 alphyn.canonica      2 u   26   64    1   73.612  -19.371   0.000
 strongbad.voice     2 u   17   64    1   70.766  -18.159   3.481
 chilipepper.can    2 u   25   64    1  134.982  -19.848   0.000
 pugot.canonical   2 u   28   64    1  135.694  -21.075   0.000
ntpq is a query tool for ntpd. The -p flag requests information about the NTP servers (or peers) ntpd is connected to. Your output will be slightly different but will list the default Ubuntu pool servers plus a few others. Remember, it can take a few minutes for ntpd to establish connections.

In this article, you’ve successfully viewed the system time, changed time zones, worked with Ubuntu’s default timesyncd service, and installed ntpd. If you have advanced timekeeping needs, you can reference the official NTP documentation, and also take a look at the NTP Pool Project, a global group of volunteers providing much of the world’s NTP infrastructure.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about us

Want to learn more? Join the DigitalOcean Community!
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in our Questions & Answers section, find tutorials and tools that will help you grow as a developer and scale your project or business, and subscribe to topics of interest.

Sign up now
About the authors
Default avatar
Jeanelle HorcasitasAuthor
Technical Writer

Educator and writer committed to empowering our community by providing access to the knowledge and tools for making creative ideas into a reality

Default avatar
Justin EllingwoodAuthor
Default avatar
Brian BoucheronAuthor
Still looking for an answer?
Ask a question
Search for more help
Was this helpful?

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Comment
November 3, 2021

Hi! I was wondering that if I set my timezone to America/New_York – using the method you described here – if my timezone will automatically update to standard time (EST) in the fall/winter when appropriate and then back to daylight time (EDT) in the spring/summer?

Creative Commons
This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 4.0 International License.

Congratulations on unlocking the whale ambience easter egg! Click the whale button in the bottom left of your screen to toggle some ambient whale noises while you read.

Thank you to the Glacier Bay National Park & Preserve and Merrick079 for the sounds behind this easter egg.

Interested in whales, protecting them, and their connection to helping prevent climate change? We recommend checking out the Whale and Dolphin Conservation.

Reset easter egg to be discovered again / Permanently dismiss and hide easter egg

card icon
Get our biweekly newsletter
Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good
Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor
You get paid; we donate to tech nonprofits.

Learn more
Featured on Community
Kubernetes Course
Learn Python 3
Machine Learning in Python
Getting started with Go
Intro to Kubernetes
DigitalOcean Products
Virtual Machines
Managed Databases
Managed Kubernetes
Block Storage
Object Storage
Load Balancers
Welcome to the developer cloud
DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel
Channel Partners
Referral Program
Affiliate Program
Investor Relations
DO Impact
Products Overview
App Platform
Managed Databases
Load Balancers
Block Storage
Tools & Integrations
Release Notes
Write for DOnations
Currents Research
Hatch Startup Program
deploy by DigitalOcean
Shop Swag
Research Program
Open Source
Code of Conduct
Newsletter Signup
Website Hosting
VPS Hosting
Web & Mobile Apps
Game Development
SaaS Platforms
Cloud Hosting for Blockchain
Startup Resources
Report Abuse
System Status
Share your ideas
DigitalOcean logo
© 2023 DigitalOcean, LLC. All rights reserved.

Sea floor left
Sea floor middle

The ntpd query tool is called ntpq. The -p flag asks ntpd for details on the peers or NTP servers it is linked to. The list of servers in your output will include the standard Ubuntu pool servers as well as a few others. Keep in mind that ntpd might establish connections slowly over time.

FAQs to Configure Time Synchronization on Ubuntu 20.04

What is NTP?

Network Time Protocol (NTP) is a widely used protocol that enables accurate time synchronization across networks and systems.

How do I restart the time synchronization service on Ubuntu 20.04?

Use the command sudo systemctl restart systemd-timesyncd to restart the time synchronization service.

Can I sync time manually on Ubuntu 20.04?

Yes, you can manually sync time by using the command sudo timedatectl set-time "YYYY-MM-DD HH:MM:SS" and replacing the placeholder with the desired date and time.

Is it possible to disable time synchronization on Ubuntu 20.04?

Yes, you can disable it by running the command sudo timedatectl set-ntp false.

How often does time synchronization occur by default?

By default, Ubuntu 20.04 synchronizes time with NTP servers every few minutes, but specific intervals may vary.

Can I configure time synchronization to a local time source?

Yes, you can configure your Ubuntu 20.04 system to synchronize time with a local NTP server or an internal time source by modifying the NTP server.


You've successfully examined the system time, switched time zones, used Ubuntu's default timesyncd service, and installed ntpd during the course of this tutorial. If you require advanced timekeeping services, you should consult the official NTP documentation as well as the NTP Pool Project, a global network of volunteers who provide a significant portion of the NTP infrastructure.

If you have any queries or doubts, please leave them in the comment below. We'll be happy to address them.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Blog - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.