Quelle heure est-il? or "What's the time, Mr Jobs?"
Teanlorg Chan
in iOS
A while ago, I was tracking down some NaNs in accelerometer-based code (smoothing device orientation for an OpenGL AR view). It turns out it wasn't my bug — UIAcceleration.timestamp was going backwards approximately every 12 minutes! Naturally, the documentation doesn't mention anything about this: This value indicates the time relative to the device CPU time base register. Compare acceleration event timestamps to determine the elapsed time between them. Assuming iPhone OS is similar enough to Mac OS X, it must be using mach_absolute_time():1
Read more…