Skip to content

Instantly share code, notes, and snippets.

@macshome
Created January 31, 2019 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save macshome/a431ec800f994678eb249e5ff552e2cd to your computer and use it in GitHub Desktop.
Save macshome/a431ec800f994678eb249e5ff552e2cd to your computer and use it in GitHub Desktop.
Function to get the uptime in seconds on Apple platforms
func getUptime() -> Int {
let nanoseconds = DispatchTime.now()
return Int(nanoseconds.rawValue / 1000000000)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment