Ruby sleep in milliseconds

The short answer is sleep(0.0001) for a millisecond.

sleep(0.0001)

The details are that it's not that simple. Depending on your platform(OS) and details on thread sleeping, which I won't go into. When you get under a second and definitely under a tenth of a second accuracy really goes down the tubes. On some computers you won't see it work on less than a second. This is a complaint on some message boards. If you need much better accuracy look into realtime linux as your OS.

Comments

Blake said…
You mean sleap(0.001).
A redundant zero.
Josh P said…
I concur with Blake. That's 0.1 millisecond.

1 millisecond would be "sleep(0.001)"

Popular posts from this blog

Vim vi how to reload a file your editing