9 Sep
2008
9 Sep
'08
8:11 p.m.
amit khandelwal wrote, On 9.9.2008 19:33:
For 1 million invocations of boost::posix_time::ptime ptm (boost::posix_time::microsec_clock::local_time() ); // Get current time It takes about 1 sec.
However, gettimeofday takes about 300 ms.
gettimeofday takes about 300 ms. // struct timeval tv; // gettimeofday(&tv, NULL);
Any pointers on why it takes so long? I want to ensure that timestamp call are not expensive. Any suggestion/recommendation? That depends on OS a lot. Linux' getttimeofday() is not that accurate but the call should be realtively cheap. On the other hand, FreeBSD's gettimeofday() is more accurate but the call is a lot more expensive, because of kernel/userland context switch.
-- VH