
On 10/22/2010 10:25 AM, ppatel@efs-us.com wrote:
Thanks for the reply. I am running on "linux/Ubuntu (Lucid)" version. Not sure if there is any API in boost like "clock_gettime()" that will return number of nanoseconds monotonically starting at unspecified point/midnight (either way).
Why not use clock_gettime(CLOCK_THREAD_CPUTIME_ID, ...) then? Last I checked, Boost didn't supply a high-res stopwatch. There was one in the Intel threading library, but it was using CLOCK_REALTIME on Linux which was not monotonic! You might also look at rdtsc if it's on your processor.
My goal is to measure how much time a particular API calls takes to run by getting end and start time in nanoseconds.
You need a start "timestamp", an end "timestamp", and a way to find the difference in nanoseconds. So why bring midnight into it? That introduces all the complexity of time zones, clock synchronization, daylight saving time, leap seconds, etc. - Marsh