diff -r 000000000000 -r 3d3dcc3116d5 DateUtils.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DateUtils.m Wed Apr 02 14:45:33 2008 -0700 @@ -0,0 +1,28 @@ +// +// DateUtils.m +// Cloudy +// +// Created by Jens Alfke on 3/25/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import "DateUtils.h" + +#include +#include +#include +#include +#include + + +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 + // 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; +} +