Returns the tuple {MegaSecs, Secs, MicroSecs} which is the elapsed
time since 00:00 GMT, January 1, 1970 (zero hour) on the assumption
that the underlying OS supports this. Otherwise, some other point in
time is chosen. It is also guaranteed that subsequent calls to this
BIF returns continuously increasing values. Hence, the return value
from now() can be used to generate unique time-stamps, and if it is
called in a tight loop on a fast machine the time of the node can
become skewed.
What does the bold sentence means? I’m a few confused as my english is not very good:)
Does it mean the time line is ascending with 45 degrees or does it mean the performance of node will decrease if invoke erlang:now/0 too often?
Thank you very much.
erlang:now/0is built so that it always returns an incremented number (that is, theMicroSecswill be always guaranteed to be bumped by 1). This is useful because it let’s you use values return bynow()as unique IDs in your system (at least during one session of the VM).However, it also means that if you run a fast enough loop (that is, sometimes faster than 1 micro second per loop) you might “request” more micro seconds than there are available. So you will actually increment the time over it’s current value! (which is of course, a very bad thing)