RFR: 8337712: Wrong javadoc in java.util.Date#toString(): "61" and right parenthesis

Raffaello Giulietti rgiulietti at openjdk.org
Fri Aug 2 10:33:31 UTC 2024


On Fri, 2 Aug 2024 07:37:31 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> src/java.base/share/classes/java/util/Date.java line 1015:
>> 
>>> 1013:      *     {@code 59}), as two decimal digits.
>>> 1014:      * <li>{@code ss} is the second within the minute ({@code 00} through
>>> 1015:      *     {@code 61}), as two decimal digits.
>> 
>> The doc mentions seconds could be in the range [0, 61]. The normal interval should be [0, 59] but maybe there are situations where leap seconds are inserted (see https://en.wikipedia.org/wiki/Leap_second). Historically, only one second has been used so I wonder why it says "61"?
>
> ![image](https://github.com/user-attachments/assets/95586ba8-5d20-40de-8ab4-47f88ba048a3)

Indeed, given that a leap second can be theoretically inserted or removed at the end of March, June, September and December, it seems strange to have second 61 as well.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20439#discussion_r1701664012


More information about the core-libs-dev mailing list