I think it might be possible to fix the SO_TIMESTAMP wall-clock problem by using it not to measure duration between ping send and ping receive, but to measure kernel-userspace latency only. That is: measure ping send/recv with MONOTONIC, and subtract the kernel-to-userspace delay from that measurement to reduce jitter. The kernel-to-userspace delay can be done using SO_TIMESTAMP + wall clock.
With such algo only the time change in the very short window between kernel-to-userspace would impact the readings.
Covered topics:
I think it might be possible to fix the SO_TIMESTAMP wall-clock problem by using it not to measure duration between ping send and ping receive, but to measure kernel-userspace latency only. That is: measure ping send/recv with MONOTONIC, and subtract the kernel-to-userspace delay from that measurement to reduce jitter. The kernel-to-userspace delay can be done using SO_TIMESTAMP + wall clock.
With such algo only the time change in the very short window between kernel-to-userspace would impact the readings.