The GNU C library ( sys/timex.h ) has some high-resolution clock functions, so although they are not POSIX, they will be portable Linux.
High Precision Clock - GNU C Library
These functions are prefixed with 'ntp', although they do not require or use any ntp service, therefore the relation is purely superficial.
Remember that although the grain size is in microseconds, the linux kernel has a delay in user space of 10 ms, so do not worry and do not expect anything more accurate.
Once you have the current high resolution, you can calculate the duration and use ( posix ) nanosleep (but again, round up to 10 ms) to set the delay. There is also clock_nanosleep , which may be of interest.
source share