javadate

most accurate time type in java?


I want to compare the performance of certain operations in my application.

Other than using the Date object, is there anything more precise?


Solution

  • public static long nanoTime() - Returns the current value of the most precise available system timer, in nanoseconds.

    As Zach Scrivener states in his answer:

    My guess is that since System.nanoTime() uses the "most precise available system timer" which apparently only has millisecond-precision on your system, you can't get anything better.