Skip to content
Browse files

Invalidate old timer if it exists

  • Loading branch information...
1 parent c6f586e commit ef34a26577fd362086c357053783004f4003a473 @viveksjain committed Dec 31, 2012
Showing with 1 addition and 0 deletions.
  1. +1 −0 Heracles/Timer.m
View
1 Heracles/Timer.m
@@ -25,6 +25,7 @@ + (void)resetTimer:(NSNotification *)notification {
+ (void)fireWithTimeIntervalSince1970:(NSTimeInterval)seconds target:(id)target selector:(SEL)selector {
fireDate = [NSDate dateWithTimeIntervalSince1970:seconds];
DLOG(@"Next fire date: %@", fireDate);
+ if (timer != nil) [timer invalidate];
timer = [NSTimer scheduledTimerWithTimeInterval:[fireDate timeIntervalSinceNow] target:target selector:selector userInfo:nil repeats:NO];
}

0 comments on commit ef34a26

Please sign in to comment.
Something went wrong with that request. Please try again.