Chinaunix
标题:
程序运行时间为什么是0?
[打印本页]
作者:
gridbird
时间:
2008-03-05 17:22
标题:
程序运行时间为什么是0?
start = clock();
sleep(5);
end = clock();
printf("run for %f seconds\n",(double)(end-start)/CLOCKS_PER_SEC);
输出结果总为0 为什么?
作者:
cugb_cat
时间:
2008-03-05 17:32
clock得到的是CPU时间,sleep进程已经睡眠了,不占用CPU时间。
作者:
prolj
时间:
2008-03-05 17:41
yong time
作者:
Kevin_zqw
时间:
2008-03-05 18:58
用time
翻译楼上
作者:
Sorehead
时间:
2008-03-06 10:16
应该是 yong shi jian
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2