#include<time.h> #include<stdio.h> int main() { double dur; clock_t start,end; start = clock(); foo();//dosomething end = clock(); dur = (double)(end - start); printf("Use Time:%f ",(dur/CLOCKS_PER_SEC)); }
精确到毫秒