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