Time for Touching
So UITouch events have a helpful method timestamp.
From the docs:
"The value of this property is the time, in seconds, since system startup the touch either originated or was last changed. You can store and compare the initial value of this attribute to subsequent timestamp values of the UITouch instance to determine the duration of the touch and, if it is being swiped, the speed of movement. "
Unfortunately, the timestamp will not tell you the time when the touch ended.
Is there a function I can call inside the touchesEnded method that would give me the equivalent time?
From the docs:
"The value of this property is the time, in seconds, since system startup the touch either originated or was last changed. You can store and compare the initial value of this attribute to subsequent timestamp values of the UITouch instance to determine the duration of the touch and, if it is being swiped, the speed of movement. "
Unfortunately, the timestamp will not tell you the time when the touch ended.
Is there a function I can call inside the touchesEnded method that would give me the equivalent time?
So I found a different solution, called MachTimer, which provides a different timing interface.
http://discussions.apple.com/thread.jspa...ID=7806800
Can't use the timestamp property of the UITouch event now, but it gets the job done.
http://discussions.apple.com/thread.jspa...ID=7806800
Can't use the timestamp property of the UITouch event now, but it gets the job done.
even better, from some accelerometer code in the GLPaint demo
CFAbsoluteTimeGetCurrent() // returns the system time
Don't know why I didn't see that earlier.
CFAbsoluteTimeGetCurrent() // returns the system time
Don't know why I didn't see that earlier.

