Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. var timer: NSTimer?
  2. var timerStart: NSDate?
  3.  
  4. func startTimer() {
  5. // get current system time
  6. self.timerStart = NSDate()
  7.  
  8. // start the timer
  9. self.timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: Selector("update:"), userInfo: nil, repeats: true)
  10. }
  11.  
  12. func update() {
  13. // get the current system time
  14. let now = NSDate()
  15.  
  16. // get the seconds since start
  17. let seconds = now.timeIntervalSinceDate(self.timerStart)
  18.  
  19. ...
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement