2012-12-28 54 views

回答

1

下面是一個描述馬赫時間轉換爲秒的文檔。 https://developer.apple.com/library/ios/qa/qa1643/_index.html

#include <mach/mach_time.h> 
... 

struct mach_timebase_info timeBaseInfo; 
mach_timebase_info(&timeBaseInfo); 

CGFloat clockFrequency = (CGFloat)timeBaseInfo.denom/(CGFloat)timeBaseInfo.numer; 
clockFrequency *= 1000000000.0; 

// clock frequency (for me) is 24000000 

因爲CGTimeInterval是在幾秒鐘內,我們可以簡單地這樣做:

uint64_t displayLinkTime = displayLink.timeStamp * clockFrequency;