I want to get the time difference in hundredth second between two touches
float starttime;
float endtime;
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
starttime = [[NSDate date] timeIntervalSince1970];
}
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
endtime = [[NSDate date] timeIntervalSince1970];
NSLog(@"starttime %f endtime %f",starttime,endtime);
float diff = endtime - starttime;
}
-
the problem is i found both endtime and starttime is same , no matter how long i touch, but if i remove timeIntervalSince1970 , it’s not
-
is there any method to get that difference
I’d better use
This is recommended way for relative timings