Merge pull request #10 from gunyarakun/fix-invalid-return
[cocotron.git] / QuartzCore / CABase.m
blobb9c232020c089beae2776e4f6bd0c606d7a5d195
1 #import <QuartzCore/CABase.h>
2 #import <Foundation/NSString.h>
4 static double conversionFactor(){
5    struct mach_timebase_info timebase;
6    kern_return_t error;
7    
8    if((mach_timebase_info(&timebase))!=KERN_SUCCESS){
9     NSLog(@"mach_timebase_info returned %d",error);
10     return 1;
11    }
13    return  0.000000001 * ((double)timebase.numer/(double)timebase.denom);
16 CFTimeInterval CACurrentMediaTime(void) {
17    uint64_t value=mach_absolute_time();
19    return ((double) value)*conversionFactor();