Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

Owning the system clock: Good enough?

PTP Operator: Integrating NTP for Time Synchronization

June 1, 2026
Joseph Richard
Related topics:
Application development and deliveryCloud servicesEdge computing
Related products:
Red Hat OpenShift

    Across numerous industries, accurate timing is a common requirement. Applications will read the system clock and expect this to be the actual real-world time. But how accurate is it actually necessary? And is knowing the approximate time better than not having any idea what time it is?

    Looking at our PTP operator more specifically, its responsibilities are threefold: managing receiving and transmitting time, controlling the system clock, and keeping metrics and raising events based on the clocks.

    What is time?

    When we talk about time, we often just look at the time on a wristwatch, and want the time to be whatever that reads, but that can be misleading. In the context of computing, we want the system time to be a value that is continuously increasing according to the real-world time. Most importantly, we want the time to be the same everywhere. Unfortunately, having the exact same time anywhere is a very hard problem to solve, so we settle for approximately the same time anywhere.

    So where does the time on a computer's system clock come from? Most commonly, it's set through the network time protocol (NTP), using either chronyd or ntpd, which provide millisecond-level accuracy. This works by a client querying the time on a remote server, and then setting the system time to match. Obviously the speed of light is finite, so by the time the packets have travelled from the server to the client, the time has changed on the server, which can lead to differences in the level of milliseconds.

    When NTP isn't good enough, you can use precision time protocol (PTP), which can achieve accuracy to within 100 nanoseconds. This works similar to NTP, setting the client time based on the server time, but estimates the packet delay end to end, and then factors that in when setting the time locally.

    Alternatively, you can use the time broadcasted by a global navigation satellite system (GNSS), essentially using that time as a source of truth. Remember, the most important thing is that we have the same time everywhere, and when using GNSS, you could be reading the same broadcasts from different geographical locations, so you should get approximately the same time. One limit of GNSS is that it's vulnerable to jamming or spoofing. Most clients using PTP as the source of time are connected (directly or through one or more PTP boundary clocks) to a local grandmaster that uses GNSS as the source of time.

    Yet another factor is holdover. Some hardware is capable of maintaining a certain level of accuracy for some duration without a new time source.

    Failing over

    We've usually operated on the assumption that if a customer is choosing to use GNSS as their time source, they absolutely require a high level of accuracy. If they're out of that specified tolerance, the consumer application must be notified and handled accordingly. In the case of a momentary loss of GNSS, the hardware's holdover capabilities maintain a level of accuracy. Unfortunately, in the case of something long-term (signal jamming, for example), the result would be the loss a source for accurate time.

    The solution we developed was to use GNSS as the primary source of time, but in the event that GNSS is lost and the hardware exits holdover, then failover to using a configured NTP server or pool as the time source. This allows us to keep the system clock within 1 millisecond of accuracy. Again, an approximate time is often better than not having any idea what time it is.

    Making it work

    Once we knew what we wanted to do, making it work was a fun challenge. The first challenge was that while our PTP operator managed PTP and GNSS, it did not manage NTP at all. NTP is enabled or disabled by the Machine Config operator (MCO), and we just required users of the PTP operator to have it disabled on their system.

    In keeping with the self-contained design of the PTP operator, we chose to add support for running a containerized chronyd to the PTP operator, allowing it to be configured through a ptpconfig custom resource definition (CRD).

    Next thing was adding precise process controls internally within the PTP-operator, essentially allowing it to enable or disable individual processes without reconfiguring and restarting everything. This was necessary for phc2sys, which we would disable by terminating without restarting, and chronyd, which we would disable by setting it to offline, but keep running in the background to allow faster failover.

    In addition, we improved the processing of ts2phc logs, to allow us to determine when ts2phc was going to SERVO_UNLOCKED (PHC in freerun), which was our failover criteria, or SERVO_LOCKED_STABLE (PHC locked to time source or in holdover), which was our recovery criteria.

    Once all these were in place, we added an internal state machine. This used the ts2phc log processing work we did to trigger either failover or recovery, and then to enable or disable each of phc2sys and chronyd, with exactly one of them enabled at any time, based on whether GNSS (using phc2sys) or NTP (using chronyd) was the time source.

    Finally, we updated our event handling to keep the system clock being reported as locked after failing over from GNSS to NTP as the source of time for the system clock.

    Going forward

    Now that we've integrated NTP with our PTP operator, the next step is likely working with the Open Radio Access Network (O-RAN) community to add event types for NTP. Further work may also be considered to add support for GNSS to PTP failover, or potentially to look at other criteria for controlling failover or recovery.

    Related Posts

    • Five different ways to handle leap seconds with NTP

    • Evaluate OpenShift cluster health with the cluster observability operator

    • Trusted execution clusters operator: Design and flow overview

    • Step-by-step guide to configuring alerts in Cluster Observability Operator

    • Red Hat Serverless Operator usage and troubleshooting in OpenShift 4

    • Brief overview of Cluster Observability Operator

    Recent Posts

    • Owning the system clock: Good enough?

    • What's new in OpenShift Container Platform system management

    • Claude as your performance analysis partner

    • LogAn: Large-scale log analysis with small language models

    • stalld’s BPF Backend: Breaking Free from debugfs

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.