有一些引用文献提到 Java 忽略闰秒:
Do Java system milliseconds take account of leap seconds?
JDK-4272347 : (cal/tz) support leap seconds ticket
然而文档Timezone Data Versions in the JRE Software提及:
New leap second 2015-06-30 23:59:60 UTC as per IERS Bulletin C 49.
第 3 方 Java 库 Time4J 使用它自己的闰秒列表。
如果Java忽略了闰秒,为什么java的tzupdater工具会添加闰秒?
最佳答案
我现在仔细查看了 TZUPDATER 和 IANA 的发行说明(在其实验位置 github/eggert/tz):
TZUPDATER 说:
The Mexican state of Quintana Roo, represented by America/Cancun, will shift from Central Time with DST to Eastern Time without DST on 2015-02-01 at 02:00. Chile will not change clocks in April or thereafter; its new standard time will be its old daylight saving time. This affects America/Santiago, Pacific/Easter, and Antarctica/Palmer. New leap second 2015-06-30 23:59:60 UTC as per IERS Bulletin C 49.
IANA 表示:
Release 2015a - 2015-01-29 22:35:20 -0800
Changes affecting future time stamps The Mexican state of Quintana Roo, represented by America/Cancun, will shift from Central Time with DST to Eastern Time without DST on 2015-02-01 at 02:00. (Thanks to Steffen Thorsen and Gwillim Law.) Chile will not change clocks in April or thereafter; its new standard time will be its old daylight saving time. This affects America/Santiago, Pacific/Easter, and Antarctica/Palmer. (Thanks to Juan Correa.) New leap second 2015-06-30 23:59:60 UTC as per IERS Bulletin C 49. (Thanks to Tim Parenti.)
由此看来,Oracle 员工很可能只是进行了复制粘贴操作,而没有过多考虑内容是否与 Java 发行版确实相关。唯一的变化是删除了作者引用。当然,事实仍然是,在实际的 OpenJDK 和 Oracle-Java 发行版中,没有代码或位置可以加载此类闰秒数据。
在我自己的回答中SO-question我还指出了最新的相关mail statement Threeten 项目领导者最终放弃了对闰秒的临时可用计划支持。所以你对 Java-8 的乐观是没有道理的。
顺便说一句,最新版本的 Time4J v2.3 现在可以部署 IANA-TZDB 中包含的闰秒信息,正如您对 TZUPDATER 工具所期望的那样。
关于java - 为什么java tzupdater要添加闰秒?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28918934/