Skip to content

Instantly share code, notes, and snippets.

@rck109d
Created May 12, 2015 16:19
Show Gist options
  • Save rck109d/fd4f409bd3277bca25ba to your computer and use it in GitHub Desktop.
Save rck109d/fd4f409bd3277bca25ba to your computer and use it in GitHub Desktop.
time taken human readable duration
import groovy.time.TimeCategory
import groovy.time.TimeDuration
long started = System.currentTimeMillis()
// TODO: CODE GOES HERE
long stopped = System.currentTimeMillis()
TimeDuration timeTaken = TimeCategory.minus(new Date(stopped-started), new Date(0))
println "timeTaken $timeTaken"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment