Win32_PTP
PTPv2 Daemon for Windows 10 with Full State Machine implementation.
A Windows C library and daemon that synchronizes clocks to microsecond precision using IEEE 1588 PTPv2, embed it in your own app or run the standalone executable for testing.
This is a Windows implementation of the Precision Time Protocol version 2 (PTPv2, also known as IEEE 1588), written from scratch in C using only the Windows API. PTPv2 is a standard used in networks where multiple devices need their clocks synchronized to within microseconds of each other, such as in audio/video production, industrial control, or telecommunications equipment.
The daemon runs in its own thread so it does not block the rest of your program while it keeps the clock in sync. You can integrate it as a library in your own project by copying a handful of files and initializing a handler object with the IP address of the network adapter you want it to use. A standalone executable is also available on the releases page for testing without writing any code.
The program supports running as a grandmaster (the device that other clocks follow) or as a slave-only device (a device that follows another clock). You can specify a network domain and a priority value that affects which device wins the automatic election for grandmaster when multiple time sources are present. Software timestamping is supported; hardware timestamping and a peer-delay measurement mechanism are listed as planned for future additions.
The author notes the code avoids branching in favor of lookup tables for performance, and that comments in the source explain not just what each section does but why those design choices were made. The project is currently in a testing phase and is part of a larger effort to build an AES67 audio-over-IP transmitter and receiver for Windows, which the author plans to release as open source when finished.
Running the executable requires administrator privileges because adjusting the system clock on Windows is a protected operation.
Where it fits
- Sync a Windows machine's clock to microsecond precision for audio/video production or industrial control networks.
- Embed PTPv2 grandmaster or slave mode into your own Windows C application by copying a handful of files.
- Test precision time synchronization on Windows without writing code using the standalone executable.