Hi @Nikos Terzis ,
Thanks for reaching out.
I took a close look at what you’re doing, and your socket setup itself looks fine. The reason you’re getting 10045 (WSAEOPNOTSUPP) on SIO_TIMESTAMPING is almost certainly not a coding issue, it’s a capability issue in the networking stack below Winsock.
SIO_TIMESTAMPING is not just a user-mode switch. When you call WSAIoctl with that control code, Winsock checks whether the underlying transport provider and NIC driver advertise timestamping support. If any layer (Winsock provider, TCP/IP stack, NDIS, or the NIC driver) does not report support, Windows immediately returns 10045.
A few important clarifications based on your scenario:
- Enabling the SoftwareTimestamping PowerShell module configures NDIS/software timestamping for the system and W32Time/PTP scenarios, but it does not guarantee that Winsock will expose
SIO_TIMESTAMPINGto user-mode UDP sockets. - Even for software timestamping, the NIC driver still needs to advertise the proper capabilities via NDIS OIDs. If it doesn’t, the IOCTL will fail.
- Windows 10 supporting PTP (slave mode) does not automatically mean that general-purpose user-mode socket timestamping is available.
- If this is running in a VM, virtual NICs almost always do not support timestamping.
- Many consumer NIC drivers simply do not expose timestamp capabilities to Winsock, even if the OS has timestamping infrastructure internally.
Given that everything works the moment you remove the SIO_TIMESTAMPING call, the most likely cause is that the specific NIC driver (or its current version) does not expose timestamping support to the Winsock layer on Windows 10 LTSC 21H2.
What I would recommend:
- Verify whether this is physical hardware (not VM).
- Check the exact NIC model and install the latest vendor driver (not just the Microsoft inbox driver).
- Confirm whether the NIC explicitly supports PTP/timestamping features in its specifications.
- Test on a known PTP-capable NIC if possible (e.g., enterprise-grade Intel adapters).
If after that SIO_TIMESTAMPING still returns 10045, you would need either different hardware or fall back to GetSystemTimePreciseAsFileTime for software-based timing.
Hope this helps! If my answer was helpful - kindly follow the instructions here so others with the same problem can benefit as well.