How do I get microsecond resolution timestamps on Windows?
I am loking for something better than QueryPerformanceCounter and QueryPerformanceFrequ
Windows is not a real-time OS.
Processes on a multitasking OS will need to yield its time to another thread/process. This gives some overhead for timing.
Every function call will have overhead thus giving a little delay when returning the request.
Furthermore, the calling system call will need your process to switch from user space mode to kernel space mode, which has relatively high latency. You can overcome this by running the entire process in kernel mode (such as device driver code).
Some OSes, like Linux or BSD, are better, but they still can not maintain accurate timing resolution to sub-microsecond (for example, the accuracy of nanosleep() on Linux is about 1 ms, not less than 1 ms), except you patch the kernel to some specific scheduler that give your application benefits.
So I think, it's better to adapt your application to follow those issues, such as by recalibrating your timing routine often, which is what your links provide. AFAIK, the highest timer resolution for Windows is still GetPerformanceCounter/Frequency() regardless of its accuracy. You can get better accuracy by running you timer pooling routine inside a separate thread, and set that thread affinity to one core processor, and set the thread priority the highest you can get.