Faking Uptime
David Dunham
dunham at mac.com
Wed Mar 19 14:26:24 PDT 2008
On 19 Mar 2008, at 11:46, David Dunham wrote:
>> Have you checked your code to make sure you're not converting an
>> uptime (TickCount, Microseconds, etc.) calculation into
>> milliseconds while using a signed 32-bit value?
>
> Well yes, I'm sure the bug is something like that. But I didn't
> spot anything obvious the last time I had a 25-day machine (which
> unfortunately got rebooted before I solved the bug). I'd like to be
> able to debug and see where the value gets flipped negative.
It's not actually negative -- I think AbsoluteToDuration maxes out
after ~25 days. (It doesn't wrap, the way its Windows equivalent does
after 50.) I'm using AbsoluteToNanoseconds now.
So now I'd still like a way to force UpTime() (it's in
DriverServices.h) to return a value of 50 days, to test my fix, and
have QA verify it.
BTW, none of these functions are documented in Xcode. And I updated
Developer Documentation yesterday...
David Dunham
Voice/Fax: 206 783 7404 http://www.pensee.com/dunham/
Imagination is more important than knowledge. -- Albert Einstein
More information about the MacOSX-dev
mailing list