1.1 --- a/DateUtils.m Wed Apr 02 14:45:33 2008 -0700
1.2 +++ b/DateUtils.m Wed May 07 16:47:44 2008 -0700
1.3 @@ -15,6 +15,22 @@
1.4 #include <unistd.h>
1.5
1.6
1.7 +/** Absolute time (since 'reference date') to NSDate. 0.0 -> nil. */
1.8 +NSDate* $date( CFAbsoluteTime time )
1.9 +{
1.10 + CAssert(time>=0.0 && time < 1.0e15, @"Bogus timestamp %g",time);
1.11 + return time ?[NSDate dateWithTimeIntervalSinceReferenceDate: time] :nil;
1.12 +}
1.13 +
1.14 +
1.15 +/** NSDate to absolute time (since 'reference date'). nil -> 0.0 */
1.16 +CFAbsoluteTime $time( NSDate* date )
1.17 +{
1.18 + return date ?[date timeIntervalSinceReferenceDate] :0.0;
1.19 +}
1.20 +
1.21 +
1.22 +
1.23 NSTimeInterval TimeIntervalSinceBoot(void)
1.24 {
1.25 // From http://developer.apple.com/qa/qa2004/qa1398.html