From: Earle Clubb Date: 2007-05-07T23:28:55+09:00 Subject: Re: 10 millisecond delay/callback > I consistently get precise timings off of it, just like that. I do not, > however, on another box -- a newer 64 bit dual core AMD, also running > Linux. On that box a wait of 0.01 seems to fairly consistently wait > about > 0.012. > > I think that is about as precise as one is going to make the timings, > with > Ruby, in any case, though. > > > Kirk Haines So I've done some more testing and I found something interesting: Code: #!/usr/bin/ruby -w require 'enumerator' a = [] 15.times do sleep 0.008000499999999999 # sleep 0.0080004999999999999 a << Time.now.usec / 1000.0 end a.each_cons(2) {|x,y| puts y-x} Results: 6.14199999999994 8.15700000000004 7.798 8.03800000000001 8.04099999999994 7.93900000000008 8.072 7.91099999999994 8.05799999999999 7.94299999999998 8.0 8.005 7.995 8.00100000000009 Now if use the second sleep expression instead of the first, I get the following results: 11.978 12.016 11.963 12.073 11.939 12.06 12.235 11.696 12.0 12.047 11.956 12.004 11.996 12.0 Can anyone explain why the delay jumps from ~8ms to ~12ms? I think this may be the root of my problem. Thanks, Earle -- Posted via http://www.ruby-forum.com/.