C: 为什么 CLOCKS_PER_SEC 在我的处理器速度是 3.10GHz 时打印 1000
C: Why CLOCKS_PER_SEC is printing 1000 when my processor speed is 3.10GHz
我的电脑配置是
英特尔酷睿 i3-2100 CPU@3.10GHz
Windows7 64 位
但是当我执行下面的代码时,为什么它打印 1000?
#include<stdio.h>
#include<conio.h>
#include<time.h>
main()
{
printf("Clock %d",CLOCKS_PER_SEC);
getch();
}
实际时钟速度应该在每秒 3.1x10^12 左右,对吗?
Clock ticks are units of time of a constant but system-specific length, as those returned by function clock
.
与处理器速度无关。
见Why is CLOCKS_PER_SEC not the actual number of clocks per second?
POSIX requires that CLOCKS_PER_SEC equals 1000000 independent of the
actual resolution.
我的电脑配置是
英特尔酷睿 i3-2100 CPU@3.10GHz
Windows7 64 位
但是当我执行下面的代码时,为什么它打印 1000?
#include<stdio.h>
#include<conio.h>
#include<time.h>
main()
{
printf("Clock %d",CLOCKS_PER_SEC);
getch();
}
实际时钟速度应该在每秒 3.1x10^12 左右,对吗?
Clock ticks are units of time of a constant but system-specific length, as those returned by function
clock
.
与处理器速度无关。
见Why is CLOCKS_PER_SEC not the actual number of clocks per second?
POSIX requires that CLOCKS_PER_SEC equals 1000000 independent of the actual resolution.