Skip to content

Instantly share code, notes, and snippets.

@zviederi
Last active May 24, 2019 11:46
Show Gist options
  • Save zviederi/0b4a03885f1251e342f07070a7f9c155 to your computer and use it in GitHub Desktop.
Save zviederi/0b4a03885f1251e342f07070a7f9c155 to your computer and use it in GitHub Desktop.
How to calculate elapsed/duration time in Groovy/Grails
import groovy.time.TimeCategory
import groovy.time.TimeDuration
def timeStart = new Date()
// do something here
def timeStop = new Date()
TimeDuration duration = TimeCategory.minus(timeStop, timeStart)
println duration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment