tags:

views:

66

answers:

3

i have following code

#include <iostream>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>

int main(){

    //nanoseconds
    int x,y;
    x=6700;
    y=10000;
    int z=0;
    clock_t t =clock();

    while (y!=0){
        z+=x<<2;
        x=x>>2;

        y>>=2;
    }
    t=clock()-t;
    t=1000*t/CLOCKS_PER_TICK;
    printf("%d\n",t);
}

but it writes that

1>c:\users\david\documents\visual studio 2010\projects\nano_seconds\nano_seconds.cpp(20): error C2065: 'CLOCKS_PER_TICK' : undeclared identifier

but i have read that there exist in c++ such keyword

+1  A: 

I believe you're looking for CLOCKS_PER_SEC.

lc
A: 

You are thinking of CLOCKS_PER_SEC

DominicMcDonnell
+2  A: 

Even Google knew the answer to this one:

http://www.google.com/search?q=CLOCKS_PER_TICK

Did you mean: CLOCKS_PER_SEC

mogsie