Are leap seconds catered for by the GregorianCalendar class?
If not, does any 3rd party library cater for it?
Are leap seconds catered for by the GregorianCalendar class?
If not, does any 3rd party library cater for it?
java.util.Date API says that
"...although the Date class is intended to reflect coordinated universal time (UTC), it may not do so exactly, depending on the host environment of the Java Virtual Machine. ... Most computer clocks are not accurate enough to be able to reflect the leap-second distinction."
Wiki says
"Because the Earth's rotation speed varies in response to climatic and geological events, UTC leap seconds are irregularly spaced and unpredictable. Insertion of each UTC leap second is usually decided about six months in advance by the International Earth Rotation and Reference Systems Service (IERS)"
that is, no class can know about future IERS decisions.
System.currentTimeMillis()
officially relates to OS timer. And since all OS I know including Microsoft, Linux and Apple are only based on UNIX specification this java system timer does not count leap seconds, only the normal milliseconds since 1970-01-01T00:00:00.000Z