views:

40

answers:

2

I have been using mach_absolute_time() for all my timing functions so far. calculating how long between frames ect.

I now want to get the exact time touch input events happen using event.timestamp in the touch callbacks.

the problem is these two seem to use completely different timers. sure, you can get them both in seconds, but their origins are different and seemingly random...

is there any way to sync the two different timers?

or is there anyway to get access to the same timer that the touch input uses to generate that timestamp property? otherwise its next to useless.

A: 

Get the initial difference between two i.e what is returned by mach_absolute_time() initally when your application starts and also get the event.timestamp initially at the same time...

store the difference... it would remain same through out the time your application runs.. so you can use this time difference to convert one to another...

mihirpmehta
umm, my brain hurts. I don't think this works tho, I did call mach_absolute_time() and compared it to the event.timestamp everytime I got a input callback, and the difference was never the same, varying quite noticeably. after all, the whole point of the timestamp would be to tell you when the even actually occurs, so the callback can be called when ever. so the difference in time between when the input actually occurs, and when the callback is actually called and I can call mach_absolute_time, is completely random and variable.
matt
you have mis interpreted my answer... just take initial difference event.timestamp returns time in exactly which reference... Can you put log statement and code for the same...
mihirpmehta
A: 

How about CFAbsoluteTimeGetCurrent?

zoul