Skip to content

Instantly share code, notes, and snippets.

@C4Code
Created October 1, 2012 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save C4Code/3812746 to your computer and use it in GitHub Desktop.
Save C4Code/3812746 to your computer and use it in GitHub Desktop.
How to get yourself an interval of time...
//
// C4WorkSpace.m
// timeInterval
//
// Created by moi on 12-09-30.
// Copyright (c) 2012 moi. All rights reserved.
//
#import "C4WorkSpace.h"
@implementation C4WorkSpace {
NSDate *start, *end;
}
-(void)touchesBegan {
start = [NSDate dateWithTimeIntervalSinceNow:0];
}
-(void)touchesEnded {
end = [NSDate dateWithTimeIntervalSinceNow:0];
CGFloat interval = [end timeIntervalSinceDate:start];
C4Log(@"You touched the screen for %4.2f seconds",interval);
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment