[erlang-questions] os:timestamp/0 and erlang:now/0
Fred Hebert
mononcqc@REDACTED
Fri Mar 13 20:02:51 CET 2015
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