t***g 发帖数: 193 | 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. | y****i 发帖数: 156 | 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;
| t***g 发帖数: 193 | 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
|
|