Re: erlang:monotonic_time() is negative
Rapsey <[email protected]> Tue, 1 Sep 2015 15:51:12 +0200
| Newsgroups | gmane.comp.lang.erlang.bugs |
|---|---|
| Message-ID | <CALDM7ZFnoVCrVbDn_h1pxoDwhnLL3xtd9F7oS+J4rEB4Ubgj-A@mail.gmail.com> |
Oh ok. Thanks for the explanation. Sergej On Tue, Sep 1, 2015 at 3:43 PM, Jesper Louis Andersen < [email protected]> wrote: > > On Tue, Sep 1, 2015 at 2:20 PM, Sergej Jurečko <[email protected]> > wrote: > >> Using 18.0.3 on OS X 10.10.5. I even tried rebooting the machine to check >> if the time turns negative after a while, but it seems it is always >> negative. >> >> erlang:monotonic_time(). >> -576460736152226213 >> > > This is the normal behavior. In order to use the full 60 bit signed value, > it is custom to start at a negative number when starting a new Erlang node: > > 1> os:type(). > {unix,freebsd} > 2> erlang:monotonic_time(). > -576460743520961806 > > 1> os:type(). > {unix,sunos} > 2> erlang:monotonic_time(). > -576460744933281955 > > And so on. You can only use monotonic_time() for doing checks relative to > itself, as in: > > B = erlang:monotonic_time(), > do_work(), > E = erlang:monotonic_time(), > Elapsed = erlang:convert_time_unit(E - B, native, micro_seconds), > ... > > As Loic writes, check the document on time and time correction. > > > > -- > J. > > _______________________________________________ > erlang-bugs mailing list > [email protected] > http://erlang.org/mailman/listinfo/erlang-bugs > > _______________________________________________ erlang-bugs mailing list [email protected] http://erlang.org/mailman/listinfo/erlang-bugs