Jonathan M Davis Wrote: > On Friday 26 November 2010 04:38:47 Michel Fortin wrote:
> > One thing I wonder about... what is the expected behaviour if you put > > the computer to sleep in the middle of the above program? With > > mach_absolute_time, the clock stops counting while the computer is put > > to sleep. Does TickDuration.currSystemTick works like that on all > > systems? If there's a difference in behaviour perhaps it should be > > documented. > > Really? That is... not good. Unacceptable in fact. Even if it were acceptable > when dealing with stop watch and benchmarking code (which is questionable), > it > totally fries Clock.currAppTick(), which tells you how long the application > has > been running. The documentation for QueryPermanceCounter() and > clock_gettime() > give no indication that the clock stops counting when a thread is sleeping. > > Do you know if there's another way to get a monotonic clock on the Mac - one > which isn't affected by sleep? Much as I'd hate to do it, it would be better > to > use gettimeofday() and forgo the monotonic clock then have a monotonic clock > which is affected by sleep. But I'd _really_ like to have a monotonic clock > if I > can. You may have misunderstood. It's when the *computer* is put to sleep, not the thread. It's still an issue, but not as bad I think. -Steve
