From: Ben Giddings Date: 2004-06-11T23:55:31+09:00 Subject: Re: The dangers of sleeping ... Dale Martenson wrote: > I guess when I think of sleeping. I don't see the relationship between > sleeping for a particular length of time and what the clock says. This may > be since I work with a lot embedded systems where tick counts are used to > for timing events. Date and time information may or may not be available. Right, and there's a vast difference between how things are done on embedded systems and on full-fledged OSes. Especially when it comes to platform-neutral languages like Ruby, they very rarely have access to low-level system services, like real time clocks. To be portable, Ruby probably uses system services that are at as high a level of abstraction as possible. Since I'm pretty sure there are no platform-independant ways of doing rtc-style timing, I would guess Ruby relies on the system clock. > I just thought it was odd that it wasn't accounted for and that its behavior > varied depending on if it was in a thread or not. Yeah, I guess it is odd, but I'd consider it a corner case. If you want to look at how sleep is implemented under the hood in Ruby, you're welcome to do it. If you can suggest a better way of doing it, so that it is able to deal with the system clock getting changed by a huge amount, that would be great! Ben