[erlang-bugs] leap-second-enabled FreeBSD doesn't work right with R12B4 erts/emulator/beam/erl_time_sup.c; correction patch included
Kenji Rikitake
kenji.rikitake@REDACTED
Thu Sep 18 04:16:02 CEST 2008
The attached patch includes an additional BIF
erlang:now_utc/0
to solve the problem, as well as the previous fix for
erlang:universaltime_to_localtime/1.
Adding a BIF is surely experimental, but I think this is the easiest way
to solve this issue. Changing erlang:now/0 semantics is quite risky.
I'm still wondering if this is the best way to deal with the systems
with leap-second-enabled wall clocks (and OSes). I'd appreciate if I
can read any comment from Erlang/OTP Team on this issue.
Regards,
Kenji Rikitake
In the message <20080914052418.GA10612@REDACTED>
dated Sun, Sep 14, 2008 at 02:23:55PM +0900,
Kenji Rikitake <kenji.rikitake@REDACTED> writes:
> I've also found out that the following three functions
>
> calendar:now_to_datetime/1
> calendar:now_to_universal_time/1 (equivalent to calendar:now_to_datetime/1)
> calendar:now_to_local_time/1
>
> do not work in the leap-second-enabled environment, due to the fact that
> erlang:now/0 shows the internal clock value as is, with gettimeofday(2).
> The converted results of the functions include the offset of
> ((TAI-UTC) - 10)
> seconds.
>
> Modifying erlang:now/0, defined as get_now() in erl_time_sup.c to
> include the offset of time2posix(3) is a possible solution, though I
> don't feel like to doing it because it will surely break the assumption
> of continuous monotonous increasing of erlang:now/0.
>
> Fixing only the calendar module functions by adding a time2posix(3)
> calculation routine written in C somewhere in the BEAM BIFs looks better
> to me, though I need to investigate further.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: erl_now_utc.patch
Type: text/x-diff
Size: 6373 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20080918/c4663d8c/attachment.bin>
More information about the erlang-bugs
mailing list