davyzhu
Advanced Member level 1
Hello all,
I use clock() to measure the time cost in my program.
But the t_clock always be the multiply of 10, for example 10, 20, 30, 40,...
And I want to get the precision of 1, such as 11, 12, 13, 14...
How can I change the t_clock's precision?
Code list below:
//-----------------
#include <cstdio>
#include <fstream.h>
#include <ctime>
void main() {
int x;
clock_t t_click,t_start;
t_start = clock();
for (x=0;x<60;x++) {
printf("%d\n",x);
}
t_click = clock() - t_start;
printf("Time Elapsed %d\n",t_click);
}
//-------------------
BTW, I use VC6.0. The environment is P3 600MHz and WinXP.
Any suggestions will be appreciated!
Best regards,
Davy
I use clock() to measure the time cost in my program.
But the t_clock always be the multiply of 10, for example 10, 20, 30, 40,...
And I want to get the precision of 1, such as 11, 12, 13, 14...
How can I change the t_clock's precision?
Code list below:
//-----------------
#include <cstdio>
#include <fstream.h>
#include <ctime>
void main() {
int x;
clock_t t_click,t_start;
t_start = clock();
for (x=0;x<60;x++) {
printf("%d\n",x);
}
t_click = clock() - t_start;
printf("Time Elapsed %d\n",t_click);
}
//-------------------
BTW, I use VC6.0. The environment is P3 600MHz and WinXP.
Any suggestions will be appreciated!
Best regards,
Davy