erlang:now() in erlang 4.9.1 on Linux
Per Hedeland
per@REDACTED
Sat Apr 22 12:32:13 CEST 2000
Geoff Wong <geoff@REDACTED> wrote:
> Anyway, the current erlang:now()
>(for Linux) is seriously flawed and should be fixed (and or eradicated;
>perhaps a different fix should be implemented for system time changes).
Eradicating erlang:now() isn't an option I think:-), but of course its
behaviour on Linux should be fixed - note though that I already told you
how to "fix" it to become as good as (e.g.:-) FreeBSD at least: Just
recompile without CORRECT_USING_TIMES defined.
>It was probably a plot by FreeBSD guys somewhere in the development
>process to discredit Linux :-)
:-) Actually the conscious plot would have made Linux look better than
FreeBSD, as it would have had the "soft adjustment" of Erlang time when
system time jumped. CORRECT_USING_TIMES was at one point defined for
everything that didn't have gethrtime() but had times() - however we
learned that times() on FreeBSD was just a wrapper around gettimeofday()
(and getrusage()), making the adjustment excercise futile of course.
So, it was decided to only use CORRECT_USING_TIMES if the OS was *known*
to have a "real" times(), i.e. one that kept ticking independent of
system time - and Linux happened to be the only one that fitted that
bill. Unfortunately it seems the actual logic of the CORRECT_USING_TIMES
case didn't undergo quite as detailed testing as the gethrtime() case
(plus of course the logic is trickier due to the low resolution of
times()).
--Per Hedeland
per@REDACTED
More information about the erlang-questions
mailing list