divya kumar wrote:
In API I notice one more thing that..System.nanoTime() take more CPU clocks than System.getmiliSeconds() method.
I'm curious as to how you determined this.
Also there is method that we call some native method and calculate the microseconds in C.
And is it actually accurate to the microsecond? Just because it reports in microseconds doesn't mean that it's actually measuring with microsecond precision.
But I have a query why Java don't provide Current Time in microsecond precision.
Any idea???
As I understand it, the underlying API that currentTimeMillis() uses was generally not accurate to within more than 5-15 ms when Java first came out, and system clocks drift enough that you probably won't get reliable microsecond timing in any case.
As I pointed out, there is the nanoTime() method, but just like currentTimeMillis(), it depends on what the underlying OS provides.