I know that System.currentTimeMillis() gives the time in milliseconds since the epoch and it is sensitive to the wall clock time of the system. I also know that it is not advisable to use System.currentTimeMillis() to calculate elapsed time in a program that measures time.
Java library have provided System.nanoTime() for that purpose.
I have two specific questions for System.currentTimeMillis():
- Does it get affected by leap second adjustments? I think the answer is yes since the wall clock time of the system will be adjusted because of the leap second.
- Does it get affected when DST (DayLight Savings) is turned on/off ? What would happen when the time suddenly changes from 23:59 to 2:00? Since the system clock actually changes I would think that the answer is again yes but I would like to check with the community.