I believe you won't reliably get sub-milliseconds delay for useful actions in practice (a Linux desktop is not a real-time system). Perhaps compiling your own kernel with CONFIG_PREEMPT
might help a little! But this is a strong limitation (and there is no software tricks to overcome that).
As Karsten Koop commented, you might use threads, or POSIX timers. See also time(7)
As Drop commented, if you compile in C++11 mode, consider using <chrono>
(it is more or less wrapping clock_gettime
in a C++11 conforming way; sou you'll be able to measure small delays).
A Linux specific solution might be to use timerfd_create(2) and poll that fd in the Qt main loop (using QSocketNotifier)
If you just want to measure (not act) time with sub-millisecond precision, just use clock_gettime(2)
Notice that several Qt operations are complex enough to need more than a millisecond to run. And human are not able to perceive (e.g. see on the screen) sub-millisecond delays. A screen is refreshed at 60Hz (or 144Hz for some costly screens), so you cannot see such small delays on it.
If you are not familiar with Linux programming, take time to read Advanced Linux Programming in addition of the hyperlinked material above (the ALP book is older than timerfd_create
)