Skip to content

Instantly share code, notes, and snippets.

@DanielCardonaRojas
Created January 3, 2021 15:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanielCardonaRojas/0d2aabe89c8ab243ef514a548ce5efc5 to your computer and use it in GitHub Desktop.
Save DanielCardonaRojas/0d2aabe89c8ab243ef514a548ce5efc5 to your computer and use it in GitHub Desktop.
TimeInterval Extensions
extension TimeInterval {
var milliseconds: Int {
return Int((truncatingRemainder(dividingBy: 1)) * 1000)
}
var seconds: Int {
return Int(self) % 60
}
var minutes: Int {
return (Int(self) / 60 ) % 60
}
var hours: Int {
return Int(self) / 3600
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment