Created
July 9, 2014 06:48
-
-
Save naoty/4af5d10e330bd25982b5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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