Yes
You are using the correct interface. This is the designated Posix HRT (High Resolution Timer), which is available in modern Loonix, and your use is the canonical standard.
For ping permissions, this probably doesn't matter, but it's possible to use CLOCK_MONOTONIC, especially for short intervals. In other conditions, CLOCK_REALTIME may be more accurate. However, the exact value of this watch is not indicated by Posix, and on Linux, I believe that all of them are subject to NTP adjustments. This is a good thing for long intervals, at least.
On Linux, to access the underlying hardware clock without NTP adjustments, you need to disable Posix redundancy and use CLOCK_MONOTONIC_RAW.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_gettime.html
source share