(Oracle) Java JVM 如何知道闰秒正在发生? [英] How does the (Oracle) Java JVM know a leap second is occurring?

查看:46
本文介绍了(Oracle) Java JVM 如何知道闰秒正在发生?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

闰秒将在 2015 年 6 月 30 日发生.不同的操作系统似乎以不同的方式处理这种情况.在我的特殊情况下,我们正在运行带有自定义 Java (JDK 1.7) 软件的 Red Hat 6.4 系统,该软件严重依赖于时间.根据一些最近红帽发布的信息我发现,我们系统的NTP守护进程会确保操作系统通过重复自动处理闰秒23:59:59 两次.

我的问题是:如果我有一个长时间运行的 JDK 1.7 进程,它怎么知道闰秒正在发生?我的意思是,Java 最终如何知道 IERS 人们决定插入闰秒?Date 文档似乎表明知道闰秒,但似乎无益的含糊不清.我可以假设 JDK,当适当的 Date 对象被构造或 Calendar.getInstance() 被调用时,它是传递到底层操作系统的日期时间处理到获得适当的实时"时间值?(在我的情况下,这听起来像是重复第二个 23:59:59,因为这是操作系统处理它的方式).

解决方案

这取决于你的 jdk 版本.例如,如果您正在运行更新 80,您可以查看发行说明:

<块引用>

JDK 7u80 包含 IANA 时区数据版本 2015a.有关详细信息,请参阅 JRE 软件中的时区数据版本.

然后点击时区数据版本的链接 并找到 2015a.然后按照 TZ Updater version1.4.11 的链接:

<块引用>

新闰秒 2015-06-30 23:59:60 UTC 根据 IERS 公告 C 49.(感谢 Tim Parenti.)

之前似乎没有包含它,所以如果您运行的是旧版本的 JDK 7,您可能不会得到调整.此处提供了有关其内部工作原理的更多信息.>

老实说,我从来没有测试过它在实践中是如何工作的.

A leap second will occur on June 30, 2015. Different Operating Systems seem to handle this situation differently. In my particular case, we are running a Red Hat 6.4 system with custom Java (JDK 1.7) software that is heavily time-dependent. According to some recent Red Hat released information I found, our system's NTP daemon will ensure the OS automatically handle the leap second by repeating 23:59:59 twice.

My question is: if I have a long running JDK 1.7 process, how does it know that a leap second is occurring? What I mean is, how does Java ultimately know the IERS people have decided to insert a leap second? The Date documentation seems to indicate is aware of leap seconds, but seems unhelpfully vague. Can I assume the JDK, when the appropriate Date object is constructed or Calendar.getInstance() is invoked, it is a pass through to the underlying OS's date-time handling to get the appropriate "real" time value? (Which, in my case, sounds like it would repeat second 23:59:59, because that's how the OS will handle it).

解决方案

It depends on your jdk version. If for example you are running update 80, you can check the release notes:

JDK 7u80 contains IANA time zone data version 2015a. For more information, refer to Timezone Data Versions in the JRE Software.

Then follow the link to the timezone data versions and find 2015a. Then follow the link to TZ Updater version1.4.11:

New leap second 2015-06-30 23:59:60 UTC as per IERS Bulletin C 49. (Thanks to Tim Parenti.)

It does not seem to have been included before so if you are running an older version of JDK 7 you will probably not get the adjustment. More information about how it works internally is available here.

To be honest I have never tested to see how it works in practice.

这篇关于(Oracle) Java JVM 如何知道闰秒正在发生?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆