Skip to content

Instantly share code, notes, and snippets.

@NZhuravlev
Created August 9, 2016 09:35
Show Gist options
  • Save NZhuravlev/ac62288845a29d15686225fc331682e6 to your computer and use it in GitHub Desktop.
Save NZhuravlev/ac62288845a29d15686225fc331682e6 to your computer and use it in GitHub Desktop.
class Timer {
long startTime = System.currentTimeMillis()
static Timer start() {
new Timer()
}
long timeSpent() {
System.currentTimeMillis() - startTime
}
long reset() {
long currentTime = System.currentTimeMillis()
long spent = currentTime - startTime
startTime = currentTime
spent
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment