[erlang-patches] Fix support for leap seconds-aware timezones.

Piotr Sikora piotr.sikora@REDACTED
Mon Jul 16 23:59:42 CEST 2012


Fix support for leap seconds-aware timezones.

erlang:universaltime_to_localtime is leap seconds-aware (since 2008),
however erlang:localtime_to_universaltime is not, which gives
surprising results on systems configured with leap seconds-aware
timezones:

1> erlang:universaltime_to_localtime({{2012,1,1},{0,0,0}}).
{{2012,1,1},{0,0,0}}
2> erlang:localtime_to_universaltime({{2012,1,1},{0,0,0}}).
{{2012,1,1},{0,0,24}}

and completely breaks calendar:local_time_to_universal_time_dst:

3> calendar:local_time_to_universal_time_dst({{2012,1,1},{0,0,0}}).
[]


git fetch git://github.com/PiotrSikora/otp.git fix-leap-seconds

https://github.com/PiotrSikora/otp/compare/fix-leap-seconds
https://github.com/PiotrSikora/otp/compare/fix-leap-seconds.patch


Note: this patch was tested on OpenBSD and it fixes the issue, but it should 
be tested on other operating systems with leap seconds-aware timezones. 
Information on how to enable them on Linux and FreeBSD can be found here:
http://thedjbway.b0llix.net/clockspeed/leapsecs.html

Best regards,
Piotr Sikora < piotr.sikora@REDACTED >



More information about the erlang-patches mailing list