From: Gary Wright Date: 2007-11-07T07:32:07+09:00 Subject: Re: Changing date backward messes up threaded sleep On Nov 6, 2007, at 4:17 PM, Rak Rok wrote: > FYI was a thread about this back in March: > http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/241281 In that thread, Tomas Pospisek suggested switching timeofday() to use a POSIX monotonic clock but his solution would have screwed up Time.now since it would no longer be returning wall clock time. It seems like there there are at least two use cases that tend to be obscured in this conversation: delay by a time interval # i.e. a stopwatch, not a wall clock delay until a time is reached # i.e. a wall clock, not a stopwatch The problem is that many systems don't have an OS supported stopwatch, only an OS supported wall clock. In addition, MRI Ruby treats the wall clock as a stopwatch and so you would have to refactor things if you had both types of clocks available. You can't just switch everything to use the stopwatch. I suspect there might be lots of hidden problems in application code if you changed sleep(), for example, to behave like a stopwatch. What if the application computes an interval based on the time of day and then calls sleep(interval)? In that case, the application *wants* a wall-clock model and not a stopwatch model. Gary Wright