I know that System.nanoTime() is now the preferred method for measuring time over System.currentTimeInMillis() . The first obvious reason is nanoTime() gives more precise timing and the other reason I read that the latter is affected by adjustments to the system’s real-time clock. What does “getting affected by systems real-time clock ” mean ?
I know that System.nanoTime() is now the preferred method for measuring time over System.currentTimeInMillis()
Share
In this case I’ve found following blog post excerpt useful:
Clocks and Timers – General Overview by David Holmes
Since
System.currentTimeMillis()is relying on the systems time of day clock, adjustments to the time are legitimate, in order to keep it on time.What means adjustments here? Take for instance a look at the description of
CLOCK_REALTIMEfrom Linux: