From: Dennis Newbold Date: 2002-04-17T13:21:04+09:00 Subject: alternatives to nanosleep / usleep ? Hi All, I'm looking for suggestions / ideas as to how to get around a particular problem: I'm basically porting some C code to a Ruby program, because I think in the long run it will be easier to maintain and modify. At a couple of points in the C code, it calls nanosleep to create a brief delay in sending commands to an external device (the host is alot faster than the external device, and in a couple of situations, you can send it a second command before its had time to complete the first one). The delay times I need are 1/8 sec. and 1/4 sec. As far as I can tell, Ruby doesn't provide access to any of nanosleep, usleep, and clock, and I have no idea how long: i = 10 while (i) i = i -1 end would take to run in Ruby, but for sure it will vary from one host system to the next. The time delays I need don't have to be too precise, but if I wait for one second (the minimum granularity of sleep()) each time, the entire process will take about 10 seconds as opposed to 2 seconds, which I'd like to avoid if possible, as the program will conceivably be executed several hundred times each day. Any help / ideas / suggestions would be appreciated. Thanks Dennis --------------------------------------------- | | | The way to be happy is to be good | | | ---------------------------------------------