Skip to content

Instantly share code, notes, and snippets.

@naoty
Created July 9, 2014 06:48
Show Gist options
  • Save naoty/4af5d10e330bd25982b5 to your computer and use it in GitHub Desktop.
Save naoty/4af5d10e330bd25982b5 to your computer and use it in GitHub Desktop.
import Cocoa
extension Int {
var seconds: NSTimeInterval {
return NSTimeInterval(self)
}
var minutes: NSTimeInterval {
return self.seconds * 60
}
var hours: NSTimeInterval {
return self.minutes * 60
}
}
@infix func + (left: NSDate, right: NSTimeInterval) -> NSDate {
return left.dateByAddingTimeInterval(right)
}
let now = NSDate.init()
let future = now + 6.hours
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment