[erlang-questions] os:timestamp/0 and erlang:now/0

Karolis Petrauskas <>
Fri Mar 13 20:23:33 CET 2015


I have specified no special arguments for time correction, at least
explicitly. `erlang:system_info(tolerant_timeofday).` returns
`enabled`.

It is very likely, that the system time was adjusted. Although the
difference between now() and os:timestamp() is not decreasing and
varies between 9.340 and 9.387 ms (I'm observing this for a half of
the day already).

Karolis

On Fri, Mar 13, 2015 at 9:02 PM, Fred Hebert <> wrote:
> Do you run any arguments regarding time correction (+c) ? The doc
> mentions:
>
> +c
>
>     Disable compensation for sudden changes of system time.
>
>     Normally, erlang:now/0 will not immediately reflect sudden
>     changes in the system time, in order to keep timers (including
>     receive-after) working. Instead, the time maintained by
>     erlang:now/0 is slowly adjusted towards the new system time.
>     (Slowly means in one percent adjustments; if the time is off by
>     one minute, the time will be adjusted in 100 minutes.)
>
>     When the +c option is given, this slow adjustment will not
>     take place. Instead erlang:now/0 will always reflect the
>     current system time. Note that timers are based on
>     erlang:now/0. If the system time jumps, timers then time out
>     at the wrong time.
>
>     NOTE: You can check whether the adjustment is enabled or
>     disabled by calling
>     erlang:system_info(tolerant_timeofday).
>
> It is possible that time has drifted forwards a bit and for a period of
> time, now() returns a time lagging behind os:timestamp() because it is
> still compensating and catching up to the absolute time change.


More information about the erlang-questions mailing list