Hello Joerg, On 03/01/2013 10:22 AM, joerg-cyril.hoe...@t-systems.com wrote: > The idea to replace X * numerator / denominator > by X / den * mul + remainder from euclidian division > came from > http://blog.airsource.co.uk/index.php/2010/03/15/quelle-heure-est-il/ > > M. Stefaniuc suggested an inline function. The MulDiv64 inline has the benefit > of ensuring unsigned arithmetic, matching GetPosition UINT64 output. My idea was to have the whole if else in an inline function. But I see that even the whole functionality can move to a helper. Something like this:
static inline ULONGLONG get_qpctime(void) { LARGE_INTEGER stamp, freq; QueryPerformanceCounter(&stamp); QueryPerformanceFrequency(&freq); if(freq.QuadPart == 10000000) return stamp.QuadPart; else return stamp.QuadPart / freq.QuadPart * 10000000 + stamp.QuadPart % freq.QuadPart * 10000000 / freq.QuadPart; } bye michael