[erlang-questions] Node uptime
Ulf Wiger
ulf.wiger@REDACTED
Tue Mar 16 14:25:43 CET 2010
On Tue, 16 Mar 2010 14:09:51 +0100, Håkan Huss <huss01@REDACTED> wrote:
> Check out erlang:statistics(wall_clock).
>
> /Håkan
statistics(wall_clock) wraps after ca 37 hours.
From overload.erl:
%% Mask equal to 2^27 - 1, used below.
-define(mask27, 16#7ffffff).
%% Returns number of milliseconds in the range [0, 2^27 - 1]. Must have
%% this since statistics(wall_clock) wraps. Having 2^27 -1 as the max
%% assures that we always get non-negative integers. 2^27 milliseconds
%% are approx. 37.28 hours.
get_now() ->
element(1, statistics(wall_clock)) band ?mask27.
This means that unless you get in from the start and continuously
sample statistics(wall_clock), it can't be relied upon.
BR,
Ulf W
--
Ulf Wiger
CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd
http://www.erlang-solutions.com
---------------------------------------------------
---------------------------------------------------
WE'VE CHANGED NAMES!
Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.
www.erlang-solutions.com
More information about the erlang-questions
mailing list