------_extPart_001_01C44F3B.B0C3E730
Content-Type: text/plain;
	charsetso-8859-1"

I learned something about Kernel::sleep that disturbs me. Compare these two
ruby programs:
 
Program #1:
 
          p "Before sleep"
          sleep 30
          p "After sleep"
 
Program #2:
 
          p "Before sleep"
          a  hread.new { sleep 30 }
          a.join
          p "After sleep"
 
Not very interesting I know, but both programs should print out the first
line, sleep for 30 seconds and then print out the second line. This is true
as long as the system clock is not altered. The first program does not
appear to be effected by modification of the system clock, but the second
program is. The effect seems to be, if the clock is set back X number of
seconds, the sleep is increased by X number of seconds. Setting the clock
forward doesn't seem to have an effect.
 
This problem came up as part of a large ruby server application where an
operator noticed the time on the server was way off and set the clock back a
couple of hours to correct the problem. The system locked up. Threads using
the sleep function never woke up. 
 
What I really need is an elapsed time which is not tied to the system clock.
A simple tick count that can be used for simple timers. I am now looking
into writing a C extension to use Posix sleep (or something equivalent). Has
anyone else run into this?
 
This was tested with Ruby 1.8.0 running on Linux.

------_extPart_001_01C44F3B.B0C3E730--