On Wed, 2018-07-25 at 02:32 -0400, Shreyas Pophli wrote:
I am using pthread_getcpuclockid() for retrieving the thread clock id and then clock_gettime() for fetching the time corresponding to particular thread clock id. This gives me time in nanoseconds.

When I use clocl_getcpuclockid()- For obtaining cpu clock id for process context and then use the clock_gettime(), it does not return the nanosecond resolution time.

I think you need to provide a bit more information here - after all, struct timespec *always* provides tv_nsec :-)

regards
Michael