java – System. Is the value returned by currenttimemillis() affected by the day light savings and leap second adjustments?
I know system Currenttimemillis () gives the millisecond time since the era, and it is very sensitive to the system wall clock time I also know that system is not recommended Currenttimemillis() to calculate the elapsed time in the program that measures time
I have two for system Specific problems of currenttimemillis():
>Is it affected by leap second adjustment? I think the answer is yes, because the wall clock time of the system will be adjusted by leap seconds. > Will DST (daylight savings) be affected when it is on / off? What happens when the time suddenly changes from 23:59 to 2:00? Since the system clock has actually changed, I think the answer is yes, but I want to contact the community
Solution
System. The value returned by currenttimemillis() is the number of milliseconds since the epoch The number of milliseconds is: milliseconds
Suppose that one day, due to DST, your country / region decides to start from 1:00 to 2:00 immediately Does this mean that an hour has passed between 1:00 and 2:00? 0 milliseconds have passed Your country / region just decided to express the millisecond value x as 1:00 and the millisecond x 1 as 2:00 The representation of time does not change in milliseconds