System.currentTimeMillis vs System.nanoTime

后端 未结 10 1248
后悔当初
后悔当初 2020-11-21 22:56

Accuracy Vs. Precision

What I would like to know is whether I should use System.currentTimeMillis() or System.nanoTime()<

10条回答
  •  闹比i
    闹比i (楼主)
    2020-11-21 23:18

    I've had good experience with nanotime. It provides wall-clock time as two longs (seconds since the epoch and nanoseconds within that second), using a JNI library. It's available with the JNI part precompiled for both Windows and Linux.

提交回复
热议问题