Created
December 14, 2016 13:10
-
-
Save crisbit/c43578e0781a97644e8d3e549232bce8 to your computer and use it in GitHub Desktop.
Calculate elapsed time in Swift
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
let start = Date() | |
print("Elapsed time: \(start.timeIntervalSinceNow) seconds") |
I think adding a minus (or absolute value) would be better, because we would have a positive elapsed time value : print("Elapsed time: \(-start.timeIntervalSinceNow) seconds")
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For UI measurements it's the best solution. Thank you so much!