场景
当前使用clock()计算ffmpeg函数耗时,偶尔出现不准确的问题,相差有100多毫秒
clock() measure the CPU time used by your process, not the wall-clock time.
When you have multiple threads running simultaneously, you can obviously burn through CPU time much faster.
当前提供如下方案,不知道是否也会出现类似的情况
1)GetTickCount();
2)
LARGE_INTEGER t1, t2, tc;
QueryPerformanceFrequency(&tc);
QueryPerformanceCounter(&t1);
//do something
QueryPerformanceCounter(&t2);
int fCount =( t2.QuadPart - t1.QuadPart)*1000 / tc.QuadPart;
本文转自fengyuzaitu 51CTO博客,原文链接:http://blog.51cto.com/fengyuzaitu/2047882,如需转载请自行联系原作者