Hm, do you want wall time or time spent by your program, reading the man page of "clock", it seems its reporting the cpu time spent by your program
Below seems to be a good tutorial on time related things in C programming. It calls out "clock" is rarely used.
I understand what you are saying about clock() Obviously the wrong thing to use to get absolute timestamps. I tried the example here
and got a segmentation fault. Perhaps I need to link rt. I can't test it until later but will post the results.
What kind of environment are u compiling your code? I dropped the tutorial code onto edison and compile on edison. works for me.
root@redacted:~/test_clock# gcc -o gettime gettime.c -lrt
elapsed time = 1000536234 nanoseconds
elapsed process CPU time = 68750 nanoseconds
I didn't do the link so I assume that is my problem. Thanks so much for showing that this works. I very much appreciate it.