Closed jodastephen closed 11 years ago
Unfortunately, leap seconds don't only happen at 23:59:60, they can happen at pretty much any local time (its always 23:59:60 UTC, but since the world has many offsets, including quarter hour ones, there is no clear way to determine if what is being parsed is a leap second or not. Options include
I'm going with the last one of these at the moment as its less vulnerable to error.
Since the time model of 310 does not include leap seconds, why should they be supported? Just because of ISO? They will not be the result of any computation in 310, nor formatting and there is no mapping from the parse to a LocalTime, so what's the point?
External text strings will on occasion have leap seconds in. Most users will not test for this. While the support in the patch is not comprehensive, it is enough to handle the common case of parsing an instant, without getting into further behaviour.
As I've probably indicated before, I think it would be better for the JDK to have a file of leap-seconds, delivered as part of the time-zone data (as we used to have). Then parsing could be handled even better. But, this patch #297 provides the basic support.
Currently, any time with second-of-minute=60 can be successfully parsed, but will fail during the resolution phase when converting to
LocalTime
. To allow leap-second aware classes to parse the input, the conversion toLocalTime
needs to be later, probably on-demand.