Created
January 31, 2019 15:47
-
-
Save macshome/a431ec800f994678eb249e5ff552e2cd to your computer and use it in GitHub Desktop.
Function to get the uptime in seconds on Apple platforms
This file contains 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
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