I want to be able to turn device motion updates on and off during my game. But after I turn them off and then back again, .deviceMotion property of CMMotionManager returns the last know deviceMotion for a short while (around 0.5 seconds, until it can calculate the fresh value, I guess).
So, I want to be able to test the age of the CMDeviceMotion objects I get, and ignore them if they're older than a few seconds.
Calculating CACurrentMediaTime() - deviceMotion.timestamp seems to give me accurate results.. But I'm worried that this might break in a future device or iOS version. Are device motion timestamps guaranteed to remain comparable with CACurrentMediaTime() in the future? Is there a better way to calculate the age of CMDeviceMotion timestamps?
From Apple's documentation:
A CFTimeInterval derived by calling mach_absolute_time() and converting the result to seconds.
The time stamp is the amount of time in seconds since the phone booted.