avatar
t*g
1
Clock() always returns zero, anyone knows the reason?
sample code:
#include
#include
#include
using namespace std;
int main(){
for(long i=0;i<10;i++)
cout << clock() <return 0;
}
Thanks a lot.
avatar
y*i
2
// from MSDN
clock():
The returned value is the product of the amount of time that has elapsed since
the start of a process and the value of the CLOCKS_PER_SEC constant.
CLOCKS_PER_SEC = 1000
the_elapse_time(sec) < 1 sec since your comuter is very fast => the_elapse_
time = 0
=> your result = 0

【在 t***g 的大作中提到】
: Clock() always returns zero, anyone knows the reason?
: sample code:
: #include
: #include
: #include
: using namespace std;
: int main(){
: for(long i=0;i<10;i++)
: cout << clock() <: return 0;

avatar
t*g
3
Yes, it's not the problem of clock(), just coz there is nothing to run. I
figured it out myself later, after put in a FFT routine. Thanks any way.

since

【在 y****i 的大作中提到】
: // from MSDN
: clock():
: The returned value is the product of the amount of time that has elapsed since
: the start of a process and the value of the CLOCKS_PER_SEC constant.
: CLOCKS_PER_SEC = 1000
: the_elapse_time(sec) < 1 sec since your comuter is very fast => the_elapse_
: time = 0
: => your result = 0

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。