Configure time synchronization

Linux Windows

Many software systems that depend on careful sequencing of events rely on a stable, consistent system clock. System logs written by most services include a timestamp, which helps debug issues that occur between various components of your system.

By default, Compute Engine instances are preconfigured to use network time protocol (NTP), which helps keep system clocks in sync with each other. By properly configuring NTP on your virtual machine (VM), you can optimize your VM's time synchronization to account for leap seconds as they occur.

If ensuring accurate time synchronization and monitoring the accuracy of your time synchronization are important goals, then instead of using NTP, you can sync your VM's clock with its host server's clock by using chrony and ptp_kvm. This configuration is designed to achieve accuracy within 1 ms for supported setups.

Configure network time protocol (NTP) on a VM

Compute Engine instances are preconfigured to use network time protocol (NTP), which helps keep system clocks in sync with each other, and includes the following:

  • Higher accuracy than third-party NTP servers.
  • Handling for leap seconds, one-second adjustments made to UTC time to account for changes in the Earth's rotation. Leap seconds don't happen at routine intervals, because the Earth's rotation speed varies irregularly in response to climatic and geological events.

For steps to configure NTP for a VM, see Configure NTP for a VM.

Configure accurate time

For accuracy designed to be within 1 ms with supported setups, you can configure your VM to sync its clock with its host server's clock. For details, see Configure accurate time for Compute Engine VMs.

What's next

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年11月03日 UTC.