转载请注明出处(不过这个用法网上到处都是):
http://www.cnblogs.com/darkknightzh/p/4987738.html
LARGE_INTEGER nFreq, nBeginTime, nEndTime; // 头文件为#include <windows.h>
QueryPerformanceFrequency(&nFreq);
QueryPerformanceCounter(&nBeginTime); // code QueryPerformanceCounter(&nEndTime);
double time = (double)(nEndTime.QuadPart - nBeginTime.QuadPart) * / (double)nFreq.QuadPart;
上述代码得到的是ms,如果需要得到s,不用 * 1000 即可。