I know this question has been asked few times over SO but none of them is really helping me out, so asking again.
I am using windows xp and running visual studio c++
Kornel's suggestion of using QueryPerformanceCounter is an excellent one.
If that doesn't work for you, and you don't mind another Windows-only solution, use the Windows "multimedia timers". Search the Visual Studio help files for "timeBeginPeriod", "timeEndPeriod", and "Using Multimedia Timers".
To use the multimedia timers, you need to include the header and link with winmm.lib:
#include
#pragma comment( lib, "winmm" ) // need this library for multimedia timers