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

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

问题描述

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



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

解决方案

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


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


然后按照时区数据版本,并找到2015a。然后按照指向TZ Updater版本1.4.11的链接


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


如果您运行的是较旧版本的JDK 7,那么以前似乎并没有被包括,所以您可能无法获得调整。有关如何在内部运行的更多信息,请此处。 p>

说实话,我从来没有测试过,看看它在实践中如何运作。


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天全站免登陆