Closed jodastephen closed 11 years ago
I hope this matures into a full IETF spec, we (JDK) can't refer to some random document that isn't endorsed by a standards body. If necessary, we will need to fully incorporate the defined behavior.
Also, in earlier discussions, we concluded that JSR 310 itself could not solve the leap-year problem and that the underlying OS was responsible. Are now making java.time responsible for smoothing? Where should it be implemented? Clock?
The key phrase is "Implementations built on an accurate leap-second aware time source". Since the JDK is not built on such as source, it does not have to use UTC-SLS. What the change is saying is that if you are built on such a source, you really should use UTC-SLS. I'm also leaving enough of a gap open that should an alternative or variant of UTC-SLS get approved (say at the 2014 UTC conference) then Java can move to it (as it would be a new version of UTC, allowing us to have a new approved conversion algorithm).
So, this is just a words change, only affecting non-Oracle-JDK implementations, and generally not affecting those.
Applied in http://hg.openjdk.java.net/threeten/threeten/jdk/rev/ca671c2e333f
(Note that I've pushed this before hearing back from my off-list reviewer, so there may yet be more tweaks, although I hope not)
Final proposed text:
The Java time scale divides each calendar day into exactly 86400
subdivisions, known as seconds. These seconds may differ from the SI
second. It closely matches the de facto international civil time
scale, the definition of which changes from time to time.
The Java time scale has slightly different definitions for different
segments of the time-line, each based on the consensus international
time scale that is used as the basis for civil time. Whenever the
internationally-agreed time scale is modified or replaced, a new
segment of the Java time scale must be defined for it. Each segment
must meet these requirements:
* the Java time scale shall closely match the underlying
international civil time scale;
* the Java time scale shall exactly match the international civil
time scale at noon each day;
* the Java time scale shall have a precisely-defined relationship to
the international civil time scale.
There are currently, as of 2013, two segments in the Java time-scale.
For the segment from 1972-11-03 (exact boundary discussed below) until
further notice, the consensus international time scale is UTC (with
leap seconds). In this segment, the Java time scale is identical to
UTC-SLS [hyperlink]. This is identical to UTC on days that do not have
a leap second. On days that do have a leap second, the leap second is
spread equally over the last 1000 seconds of the day, maintaining the
appearance of exactly 86400 seconds per day.
For the segment prior to 1972-11-03, extending back arbitrarily far,
the consensus international time scale is defined to be UT1, applied
proleptically, which is equivalent to the (mean) solar time on the
prime meridian (Greenwich). In this segment, the Java time scale is
identical to the consensus international time scale. The exact
boundary between the two segments is the instant where UT1 = UTC
between 1972-11-03T00:00 and 1972-11-04T12:00.
Implementations of the Java time-scale using the JSR-310 API are not
required to provide any clock that is sub-second accurate, or that
progresses monotonically or smoothly. Implementations are therefore
not required to actually perform the UTC-SLS slew or to otherwise be
aware of leap seconds. JSR-310 does, however, require that
implementations must document the approach they use when defining a
clock representing the current instant.
ok.
Where will the JDK implementation document the approach of following the system clock?
That needs documenting in Clock
, where it currently refers to System.currentTimeMillis()
Following some off-list feedback, I'm proposing some slight tightening of the Java time-scale spec: