Link to home
Start Free TrialLog in
Avatar of zizi21
zizi21

asked on

urgent:gethrtime

hi,

i am using hrtime_t and it cant seem to compile..if i am interested in finding time between code, do i use gethrtime or is there anything else?i am using linux.
Avatar of Infinity08
Infinity08
Flag of Belgium image

>> and it cant seem to compile.

Maybe you could show some code, and explain how it doesn't compile, by posting the exact error messages, etc.
Avatar of zizi21
zizi21

ASKER

ok..
these are the errors...
--------------------
test.c:159: error: `hrtime_t' undeclared (first use this function)
test.c:159: error: (Each undeclared identifier is reported only once for each function it appears in.)
test.c:159: error: expected `;' before "start"
test.c:162: error: `start' undeclared (first use this function)
test.c:162: error: `gethrtime' undeclared (first use this function)
test.c:165: error: `end' undeclared (first use this function)
make: *** [test.o] Error 1

--------------------------
#include <sys/time.h>
hrtime_t start, end;
int i, iters = 100;

start = gethrtime();
for (i = 0; i < iters; i++)
       printf("hello");
end = gethrtime();

---------------------
i am running on linux and i am getting an errors. but when i run on solaris...no error and the code compile..
ASKER CERTIFIED SOLUTION
Avatar of Infinity08
Infinity08
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of zizi21

ASKER

thanks a million..