System.currentTimeMillis vs System.nanoTime

Fonte

http://stackoverflow.com/questions/351565/system-currenttimemillis-vs-system-nanotime Show archive.org snapshot

Resumindo

Utilizar System.nanoTime é bem mais confiável que System.currentTimeMillis

Exemplo

long startTime = System.nanoTime();
// ... o código sendo medido
long estimatedTime = System.nanoTime() - startTime;
Bruno Vieira Over 8 years ago