
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). My goal is to measure how much time a particular API calls takes to run by getting end and start time in nanoseconds. Thanks again, Priyank -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Norbert Wenzel Sent: Friday, October 22, 2010 10:05 AM To: boost-users@lists.boost.org Subject: Re: [Boost-users] [date-time] Getting time from midnight in nanoseconds On 22.10.2010 15:48, ppatel@efs-us.com wrote:
Can you please tell me if there is a way to get current time in nanoseconds using boost date_time library?
I have tried following but it doesn't seems to be returning values in nanoseconds. I know I have used microsec_clock and that might be the problem but not sure what alternate to use. [...] return duration.total_nanoseconds(); // This call returns values in microseconds (last three digits are always zero in returned value)
Hi, as far as I remember microsecond_clock uses the highest resolution clock available on your system. On Windows this is a clock with microsecond resolution (in fact it seems to be even more than one microsecond). If you are requesting nanoseconds and nanoseconds are not supported by your system clock all unknowns will be filled with 0. I do not know of any other solution than yours, so I'm afraid you'll have to stick to your current resolution. hth, Norbert _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users