Closed GoogleCodeExporter closed 8 years ago
As a rule, for timings don't convert them to floats until you need to. By
storing the raw clock ticks this problem should go away. Make start and end to
be timeval structs. There should be two GetElapsedTime() functions. One that
returns clockticks, and one that returns it in double precision for
microseconds.
#if defined(__linux__) || defined(__APPLE__)
double start;
double end;
double ClockTime()
{
struct timeval t;
gettimeofday(&t, 0);
return t.tv_sec + t.tv_usec / 1000.0;
}
#endif
Original comment by crb...@gmail.com
on 9 Jul 2011 at 11:28
My quick and dirty hack. Not tested, and for __APPLE__ we should be using the
mach timer.
Original comment by crb...@gmail.com
on 9 Jul 2011 at 11:51
Attachments:
The change for this is done now.
Original comment by crb...@gmail.com
on 25 Jul 2011 at 2:48
Original issue reported on code.google.com by
crb...@gmail.com
on 9 Jul 2011 at 11:09