Why is subtracting these two times (in 1927) giving a strange result?

前端 未结 10 954
既然无缘
既然无缘 2020-11-21 08:10

If I run the following program, which parses two date strings referencing times 1 second apart and compares them:

public static void main(String[] args) throw         


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

    I'm sorry to say, but the time discontinuity has moved a bit in

    JDK 6 two years ago, and in JDK 7 just recently in update 25.

    Lesson to learn: avoid non-UTC times at all costs, except maybe for display.

提交回复
热议问题