#include // #include "currTime.h" // extern double currTime(); // 使用高精度计时器 static LARGE_INTEGER freq; static BOOL initFreq() { BOOL ret; if ( !QueryPerformanceFrequency( &freq) ) { ret=FALSE; } else { ret=TRUE; } return ret; } double currTime() // 使用高精度计时器 { LARGE_INTEGER performanceCount; BOOL result; double time=0.0; BOOL bRet=TRUE; if (freq.QuadPart==0) { bRet=initFreq(); } if (bRet) { result=QueryPerformanceCounter( &performanceCount ); time= performanceCount.HighPart * 4294967296.0 + performanceCount.LowPart; time=time / ( freq.HighPart * 4294967296.0 + freq.LowPart); } return time; }