[erlang-questions] writing a delay loop without now()

James Hague <>
Wed Feb 18 02:10:51 CET 2009


I need more resolution than timer:sleep() will give me. (timer:sleep
gives widely varying results, based on the underlying operating
system).  Ugly though it may be, I've been using a spin loop based on
now() and timer:now_diff().  While this appears to work, based on the
values returned by now(), it runs much faster than wall clock time.
I'm assuming it's because of this:

"It is also guaranteed that subsequent calls to this BIF returns
continuously increasing values."

Is there another BIF I should be using?  I'm hoping I don't have to
write my own linked-in driver for this.

James



More information about the erlang-questions mailing list