JDK-4272347 : (cal/tz) support leap seconds
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 1.3.0,5.0
  • Priority: P5
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic,linux
  • CPU: generic,x86
  • Submitted: 1999-09-16
  • Updated: 2024-10-09
  • Resolved: 2013-04-26
Description
[Gregorian]Calendar accept the value 0 to 59 as SECOND field. There are leap second that can take value of 0 to 60 -- actually, UNIX C library defines second is range from 0 to 61. Also, when calcurating UTC from/to Calendar, leapseconds should be considered.

Olson public time zone data 1999e lists,

# @(#)leapseconds	7.12

# Allowance for leapseconds added to each timezone file.

# The International Earth Rotation Service periodically uses leap seconds
# to keep UTC to within 0.9 s of UT1
# (which measures the true angular orientation of the earth in space); see
# Terry J Quinn, The BIPM and the accurate measure of time,
# Proc IEEE 79, 7 (July 1991), 894-905.
# There were no leap seconds before 1972, because the official mechanism
# accounting for the discrepancy between atomic time and the earth's rotation
# did not exist until the early 1970s.

# The correction (+ or -) is made at the given time, so lines
# will typically look like:
#	Leap	YEAR	MON	DAY	23:59:60	+	R/S
# or
#	Leap	YEAR	MON	DAY	23:59:59	-	R/S

# If the leapsecond is Rolling (R) the given time is local time
# If the leapsecond is Stationary (S) the given time is UTC

# Leap	YEAR	MONTH	DAY	HH:MM:SS	CORR	R/S
Leap	1972	Jun	30	23:59:60	+	S
Leap	1972	Dec	31	23:59:60	+	S
Leap	1973	Dec	31	23:59:60	+	S
Leap	1974	Dec	31	23:59:60	+	S
Leap	1975	Dec	31	23:59:60	+	S
Leap	1976	Dec	31	23:59:60	+	S
Leap	1977	Dec	31	23:59:60	+	S
Leap	1978	Dec	31	23:59:60	+	S
Leap	1979	Dec	31	23:59:60	+	S
Leap	1981	Jun	30	23:59:60	+	S
Leap	1982	Jun	30	23:59:60	+	S
Leap	1983	Jun	30	23:59:60	+	S
Leap	1985	Jun	30	23:59:60	+	S
Leap	1987	Dec	31	23:59:60	+	S
Leap	1989	Dec	31	23:59:60	+	S
Leap	1990	Dec	31	23:59:60	+	S
Leap	1992	Jun	30	23:59:60	+	S
Leap	1993	Jun	30	23:59:60	+	S
Leap	1994	Jun	30	23:59:60	+	S
Leap	1995	Dec	31	23:59:60	+	S
Leap	1997	Jun	30	23:59:60	+	S
Leap	1998	Dec	31	23:59:60	+	S

Comments
Leap seconds will not be supported with java.util.Calendar/TimeZone.
26-04-2013

EVALUATION Porting the Olson mechanism will soleve the problem. However, we should wait for user requirements on this. It will produce inconsistent dates with platform values. masayoshi.okutsu@Eng 2000-02-14 Linux seems to support leap seconds with the right/* time zones (e.g., TZ=right/America/Los_Angeles). Therefore, Linux libc and Java produce different dates with those time zones. masayoshi.okutsu@Eng 2000-05-01 Java can't support the right/* time zones due to this restriction. ###@###.### 2003-10-27
01-05-2000