为什么 Java 支持精确到秒的时区偏移量?

Why does Java have support for time zone offsets with seconds precision?

On Wikipedia time zone offsets are explained as the difference in hours and minutes from standard UTC time. However, DateTimeFormatter 支持区域偏移模式 XXXXX,其中 "outputs the hour and minute and optional second, with a colon, such as '+01:30:15'."

+01:30:15 ISO 之类的偏移是否有效?如果不是,Java 根据哪个标准定义此类偏移量?

它不受 ISO-8601 支持,但它 IANA 时区数据库中记录的有效偏移量。

在 19 世纪末和 20 世纪初的数据中,在时区被适当标准化之前,亚分钟偏移量很常见。例如,Europe/Paris 在 1911 年之前的偏移量为 +00:09:21(根据 IANA 数据库)。

我能找到的最近一次出现的是 Africa/Monrovia,它在 1972 年之前有一个亚分钟的偏移量!

额外精确的一个原因是我们都熟悉的国家时区并不是故事的结局。

如果您查看 UTC 所基于的 Wikipedia's article on UTC you'll see a selection of time standards that have second (and even fractional second) offsets from UTC.Of particular interest is TAI (International Atomic Time) 下的 "See also" 部分。目前的差异是 37 秒,因为 UTC 包括闰秒而 TAI 不包括。因此支持父标准需要秒级精度。

GPS time 也相对于 UTC 偏移了秒数(相对于 TAI 的偏移量固定为 19 秒)。 GPS 时间和 TAI(或其其他衍生物)对于导航、telecoms/broadcast 和 space 科学很重要。

一旦你进入天文学,事情就会变得更加复杂。 Terrestrial time(维基百科)与更常见的尺度有分数偏移:TT ≅ TAI + 32.184 s(精确到毫秒;TT 比这复杂得多)。

进一步阅读,因为它尚未与此问题相关联:Falsehoods programmers believe about time (and timezones, dates, etc.) - 包括一些有趣的背景。