Boost logo

Boost Users :

Subject: Re: [Boost-users] [date-time] Getting time from midnight in nanoseconds
From: ppatel_at_[hidden]
Date: 2010-10-22 11:25:00


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_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Norbert Wenzel
Sent: Friday, October 22, 2010 10:05 AM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] [date-time] Getting time from midnight in nanoseconds

On 22.10.2010 15:48, ppatel_at_[hidden] 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_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net