Embedded Development

Precision Time Protocol (PTP) support in AXIS OS 

2026-01-30

Post by:

4 hands holding each other

I have received encouraging feedback on writing about real use cases from the field and the positive outcomes that emerge when we in R&D bring these insights back to the office to help partners and customers address them. So, I thought I’d share a recent story about time synchronization! 

If you read the AXIS OS 12.7 release notes, you might have noticed this: 

Screen shot of text talking about Precision Time Protocol (PTP)

With AXIS OS 12.7, we now offer out-of-the-box support for the Precision Time Protocol (PTP)—exciting news indeed! 

Behind this feature lies a story of how Axis, by first doing a proof-of-concept, could try out new functionality with a customer, which then led to a published open-source additional software component for Axis devices that was used to such an extent where we decided to make it an integral part of AXIS OS.  

All in an organic process of making sure to keep AXIS OS lean by not bloating it with unused features, working incrementally with the mindset that—as far as humankind knows—Big Bang has only worked successfully once in the history of the universe (and that wasn’t in the field of software development!). If you’re, like I guess most people on this planet, unfamiliar with PTP: fear not! Let’s start with a brief explanation: 

On your computer or mobile device, you’re most likely using the Network Time Protocol (NTP) to synchronize time over the network. Your device asks an NTP server for the current time and then adjusts the time accordingly. 

PTP, on the other hand, doesn’t rely on a dedicated time synchronization server. Instead, devices that need to synchronize time communicate with each other and elect one of them as the time reference that all others will follow. (It’s like those action movies where before a heist, the team members pull up their watches to ensure that they all are in sync.)

Now, what about the precision aspect? To make a rather broad generalization: NTP typically handles time synchronization at the millisecond level, while PTP operates at microsecond level. With hardware support, PTP can achieve nanosecond accuracy, while high-precision NTP implementations can reach about the same accuracy range as standard PTP.  

For most use cases within our industry, NTP has plenty enough precision. Over the years when Axis has received questions about it, I have learned to ask: “What is it in in your specific use case that requires the higher accuracy of PTP?”.  

Very often, the requester didn’t really need the higher precision but had read about PTP in some tech blog (hmm…), thinking it sounded cool but not really considering if it was truly necessary (and it usually wasn’t). However, there was this time a few years back when one or our customers responded “Oh, we don’t care about the precision part, NTP is quite sufficient when it comes to that, what we need is the election protocol and not having a time synchronization server in our system!”They knew exactly what they wanted and why they wanted it, and it was crucial for them. This time, things were real! 

My department works with future system-enabling technologies. When Axis doesn’t really know how to do something (concerning system solutions) and needs to investigate if and how it can be done, then this is a mission for us. Hence, we took the first stab at this: 

Since the customer didn’t really need higher precision than NTP, simple software-only PTP without any hardware support would be more than sufficient. I put together the simplest experiment of all by using the well-tested open-source standard piece of software PTPd, to see if that would work.  

I used the Axis Camera Application Platform (ACAP) SDK for conveniently building and packaging an unmodified version of PTPd to have a smooth way to install it on an Axis device, verified that it worked (it did) and sent it to them to test as an experiment. “Works great, thanks a lot!”, was the response back—I love it when we have customers who are willing to work as a team and do proof-of-concepts to help drive technology forward for mutual benefit! 

On the Axis side, it was decided that this was a good opportunity to use the proof-of-concept packaging of PTPd as an example of how the ACAP SDK could be used to not only build your own applications, but also package unmodified third-party software like PTPd to run on your Axis device. After passing through our internal open-sourcing process, it was published in Axis’ GitHub space: https://github.com/AxisCommunications/ptpd2-acap

We had anticipated that other entities with a need for PTP could also benefit from this, which was also confirmed after publishing—indeed a very good synergy! 

Back then, AXIS OS 12 was coming up with the, in my opinion, very good root removal (I’ve been running Linux since before Microsoft released Windows 95 and for all reasons never want to run applications with more privileges than they need).  

Almost every ACAP application I have (and I’ve made a lot of them over the years since it’s so convenient for the prototyping of different things I do all the time) would run nicely as non-privileged users with one exception: the ACAP-packaged PTPd. Why? As it turns out, during the startup process, PTPd asks the system which user id it is running as. And if it’s not 0 (which is root), PTPd prints an error message and exits: 

if(geteuid() != 0) 
{ 
    printf("Error: "PTPD_PROGNAME" daemon can only be run as root\n"); 
    *ret = 1; 
    goto fail; 
} 

Would we then try to patch PTPd, look for some other implementation, or just leave it at that? 

Having tested PTP extensively in the field with real users and use cases over a significant period, Axis now recognized that PTP had evolved to functionality here to stay in our field. We maintain a cautious approach to avoid bloating AXIS OS with unused bells and whistles, while ensuring widely used core functionality has its rightful place.  

This led to discussions among the AXIS OS team that perhaps now was the time to integrate PTP as a fundamental part of AXIS OS. In the spirit of one of our core values, “act as one” (I love our core values because they are real in our daily work and not just words in a presentation), they gathered all stakeholders and us who had been involved in proof-of-concepts to give the best possible foundation for this task. The AXIS OS team then shifted into architectural design and implementation mode. Result: 

In the AXIS OS 12.7 release, PTP support was included out-of-the-box—a decision made not only by listening to but also by working closely as a team with our customers. 

Tags