mach_timebase_info consistancy

Referring to Apple Q&A QA1398, the sample code initializes the mach_timebase_info once, and then assumes that ticks -> time fraction remains constant for the rest of the program execution.


Is this safe? Depending on what underlying hardware timing mechanism is being used, would this fraction not change?


As an example, the A10 with ARM big.LITTLE. Would there be a difference in the tick -> time fraction when running on the low-energy or high-performance cores?

Accepted Reply

Is this safe?

Yes. If the underlying clock rate changes,

mach_absolute_time
will do the necessary conversions.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Replies

Is this safe?

Yes. If the underlying clock rate changes,

mach_absolute_time
will do the necessary conversions.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thanks @eskimo - saving my **** again!