* Minor fixes to glitches detected by the clang static analyzer.
* Added MYAnimatingSplitView class.
5 // Created by Jens Alfke on 3/25/08.
6 // Copyright 2008 Jens Alfke. All rights reserved.
12 #include <CoreServices/CoreServices.h>
13 #include <mach/mach.h>
14 #include <mach/mach_time.h>
18 /** Absolute time (since 'reference date') to NSDate. 0.0 -> nil. */
19 NSDate* $date( CFAbsoluteTime time )
21 CAssert(time>=0.0 && time < 1.0e15, @"Bogus timestamp %g",time);
22 return time ?[NSDate dateWithTimeIntervalSinceReferenceDate: time] :nil;
26 /** NSDate to absolute time (since 'reference date'). nil -> 0.0 */
27 CFAbsoluteTime $time( NSDate* date )
29 return date ?[date timeIntervalSinceReferenceDate] :0.0;
34 NSTimeInterval TimeIntervalSinceBoot(void)
36 // From http://developer.apple.com/qa/qa2004/qa1398.html
37 uint64_t abstime = mach_absolute_time();
38 // Have to do some pointer fun because AbsoluteToNanoseconds
39 // works in terms of UnsignedWide, which is a structure rather
40 // than a proper 64-bit integer.
41 Nanoseconds elapsedNano = AbsoluteToNanoseconds( *(AbsoluteTime *) &abstime );
42 return *(uint64_t*)&elapsedNano / 1.0e9;
48 Copyright (c) 2008, Jens Alfke <jens@mooseyard.com>. All rights reserved.
50 Redistribution and use in source and binary forms, with or without modification, are permitted
51 provided that the following conditions are met:
53 * Redistributions of source code must retain the above copyright notice, this list of conditions
54 and the following disclaimer.
55 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
56 and the following disclaimer in the documentation and/or other materials provided with the
59 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
60 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
61 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRI-
62 BUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
63 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
64 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
65 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
66 THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.