Skip to content

Instantly share code, notes, and snippets.

@greggjaskiewicz
Created January 22, 2019 20:39
Show Gist options
  • Save greggjaskiewicz/a4b97f5e4ae9d326a6bc1a497db22cf4 to your computer and use it in GitHub Desktop.
Save greggjaskiewicz/a4b97f5e4ae9d326a6bc1a497db22cf4 to your computer and use it in GitHub Desktop.
TimeInterval extension with literal intervals commonly needed
extension TimeInterval {
static var second: TimeInterval { return 1 }
static var minute: TimeInterval { return 60 }
static var hour: TimeInterval { return 60 * self.minute }
static var day: TimeInterval { return 24 * self.hour }
static var week: TimeInterval { return 7 * self.day }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment