Do Java system milliseconds take account of leap seconds?

前端 未结 5 707
情话喂你
情话喂你 2021-01-11 15:13

The java function System.currentTimeMillis() apparently returns the number of seconds since 1st January 1970. However, according to wikipedia.org/wiki/Leap_second,

5条回答
  •  不要未来只要你来
    2021-01-11 15:45

    POSIX requires that the system clock not admit the existence of leap seconds. MS Windows cannot guarantee the quality (nor existence) of the system clock hardware, and it has eschewed guarantee of 1-second accuracy. Java cannot easily do anything that the underlying system refuses to do. The operating systems are hamstrung by the history of the international regulations that result in one IEEE standard (PTP) that requires leap seconds and another (POSIX) that denies them.

提交回复
热议问题