Does your language handle leap second?
by Paweł Świątkowski
Every once in a while (some people approximate it with ‘about two years’) an extra second is added to calendar to make our atomic time more aligned with solar time. The reason for that are irregularities in how the earth spins around. The need to adjust an extra second is issued by International Earth Rotation and Reference Systems Service (which is, by the way, a cool name to have in your CV, if you have a chance). It happend in 2012, causing quite a mess, and it will happen soon. More precisely, tomorrow (30.06.2015).
How does it look in practice? An extra second is added at the end of the day in UTC, so the time goes as follows:
… or Ruby …
… or Erlang …
The reason for that seems to be explained in DataStax’s article
From the Linux time system’s point of view, the last second of June 30th will repeat itself as another second with the same timestamp as the one previous is inserted at the end of the day.
So, basically, the system will have 23:59:59 twice and we cannot really know what second this is really about. If you have some code relying on time differences, you are probably on your own with taking care of that condition. Other strategy was chosen by Amazon in AWS - they decided to add a fractions of second during few hours surrounding the leap second moment, thus minimizing impact of a “misplaced” second itself. As it seems for Windows, they ignore leap second totally and time gets synchronized on next request.