1

My PC configuration is

Intel Core i3-2100 CPU @3.10GHz

Windows7 64 bit

But when I'm executing below code why it's printing 1000?

#include<stdio.h>
#include<conio.h>
#include<time.h>
main()
{
    printf("Clock %d",CLOCKS_PER_SEC);
    getch();
}

The actual clock speed should be around 3.1x10^12 per sec right?

maazza
  • 6,646
  • 15
  • 58
  • 94
Anurag Chakraborty
  • 401
  • 2
  • 4
  • 20

2 Answers2

4

Clock ticks are units of time of a constant but system-specific length, as those returned by function clock.

It has nothing to do with the processor speed.

Amadan
  • 179,482
  • 20
  • 216
  • 275
1

see 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.

Community
  • 1
  • 1
maazza
  • 6,646
  • 15
  • 58
  • 94