作者dozer (rezod)
看板LinuxDev
标题Re: [问题] 计算时间
时间Tue Jan 9 23:28:16 2007
我自己还没试过 但之前有google过
这是其中一个 参考看看吧
http://www.delorie.com/gnu/docs/glibc/libc_436.html
ANSI C本身好像没有支援到msec以下的精确度
但找standard library以外的library应该可以
这个用的是glibc 是linux底下的c stdandard lib
非unix家族的平台应该没得用
※ 引述《leslieha (哈)》之铭言:
: 计算执行时间
: clock_t t1, t2;
: double diff;
: t1 = clock();
: funciton();
: t2 = clock();
: diff = (double)(t2 - t1)/CLOCL_PER_SEC;
: 精准度可到 msec
: windows 有
: QueryPerfromance
: 得到CPU clock数 以及 CPU的频率
: 精准可以到 0.xxxxxx msec
: 想请问
: UNIX有其它计算时间的函式
: 可以到 usec 或是 nsec的吗?
--
The inherent vice of capitalism is the unequal sharing of blessings;
the inherent virtue of socialism is the equal sharing of misery.
-- Churchill
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 122.126.35.52
※ 编辑: dozer 来自: 122.126.35.52 (01/09 23:36)