系统时间精确得到很不容易呀,函数名够长的!
精确得到系统时间 #include <windows.h>#include <iostream> int main(int argv, char* argc[]) { LARGE_INTEGER t1,t2,feq; QueryPerformanceFrequency(&feq);//每秒跳动次数 QueryPerformanceCounter(&t1);//测前跳动次数 for(int i = 0;i<10000;i++); QueryPerformanceCounter(&t2);//测后跳动次数 double d=((double)t2.QuadPart-(double)t1.QuadPart)/((double)feq.QuadPart);//时间差秒 std::cout<<d<<std::endl; } |
评论