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
  • 7,016
  • 15
  • 63
  • 96
Anurag Chakraborty
  • 421
  • 2
  • 5
  • 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
  • 191,408
  • 23
  • 240
  • 301
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
  • 7,016
  • 15
  • 63
  • 96