diff -r e5976864dfe9 -r 5cab3034d3a1 DateUtils.m --- a/DateUtils.m Sat May 24 13:24:33 2008 -0700 +++ b/DateUtils.m Wed Sep 02 08:41:25 2009 -0700 @@ -33,13 +33,17 @@ NSTimeInterval TimeIntervalSinceBoot(void) { - // From http://developer.apple.com/qa/qa2004/qa1398.html - uint64_t abstime = mach_absolute_time(); - // Have to do some pointer fun because AbsoluteToNanoseconds + // Adapted from http://developer.apple.com/qa/qa2004/qa1398.html + // Have to do some union tricks because AbsoluteToNanoseconds // works in terms of UnsignedWide, which is a structure rather // than a proper 64-bit integer. - Nanoseconds elapsedNano = AbsoluteToNanoseconds( *(AbsoluteTime *) &abstime ); - return *(uint64_t*)&elapsedNano / 1.0e9; + union { + uint64_t asUInt64; + UnsignedWide asUWide; + } t; + t.asUInt64 = mach_absolute_time(); + t.asUWide = AbsoluteToNanoseconds(t.asUWide); + return t.asUInt64 / 1.0e9; }