Are leap seconds catered for by the GregorianCalendar class?
If not, does any 3rd party library cater for it?
Insertion of each UTC leap second is usually decided about six months in advance by the International Earth Rotation and Reference Systems Service (IERS), to ensure that the difference between the UTC and UT1 readings will never exceed 0.9 seconds.
Leap second events occur on either June 30th or December 31st and do not happen very often - about every two-three years. The International Earth Rotation and Reference Systems Service (IERS) is responsible for notifying the public when a leap second will be inserted.
Leap seconds are added in order to keep the difference between UTC and astronomical time (UT1) to less than 0.9 seconds. The International Earth Rotation and Reference Systems Service (IERS), measures Earth's rotation and publishes the difference between UT1 and UTC.
Latest update: In July 2022, the International Earth Rotation and Reference Systems Service (IERS) announced that “NO leap second will be introduced at the end of December 2022.” The next possible date is June 30, 2023.
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.000Zjava.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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With