Java System.currentTimeMillis() – Effect of Changing System Time

javatime

If I use System.currentTimeMillis() at 00:00 and I get X value.

Then I set the clock back one hour, and after one hour i call System.currentTimeMillis().

Will it return X again, or will it just be X + 3600 * 1000

Best Answer

In a nutshell, whenever you change system time, the value returned by System.currentTimeMillis() will change accordingly.

This is in contrast to System.nanoTime().

Related Question