Results 1 to 2 of 2
What is the best way to track elapsed real-time,
for the most kinds of Linux systems?
clock_gettime() looks great,
but I get this build error:
undefined reference to `clock_gettime'
..even ...
- 01-28-2010 #1Just Joined!
- Join Date
- Jan 2010
- Location
- The Sillicon Valley, California
- Posts
- 28
is clock_gettime() best for elapsed time?
What is the best way to track elapsed real-time,
for the most kinds of Linux systems?
clock_gettime() looks great,
but I get this build error:
undefined reference to `clock_gettime'
..even though I have #include "time.h"
Here is my uber-goal:
// Returns fractional seconds that have elapsed since Start_Ticks was set.
float elapsed_seconds( unsigned Start_Ticks )
{
struct timespec tp;
clock_gettime( CLOCK_REALTIME, &tp );
return ( tp.tv_nsec - Start_Ticks ) / (double)1000000;
}
- 01-29-2010 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,970
That is a linker error, not a compile error. Show how you are building your program, and tell us which source file has the implementation of elapsed_seconds() and which main().
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote