Looking at the source, The Timer
class schedules tasks using System.currentTimeMillis()
. The ScheduledThreadPoolExecutor
uses System.nanoTime()
.
currentTimeMillis()
will tend to use the OS clock, the one that tracks the current date/time. nanoTime()
will tend to use a higher resolution hardware clock.
If you move your OS clock back an hour, then currentTimeMillis()
could should reflect that while nanoTime()
should not.