Code Snippets, Ideas and Rants from a Tech Lead interested primarily in server side web development and leading teams who build web apps.
Wednesday, October 13, 2010
Time durations
Some code that shows durations and works nicely as a timer
import groovy.time.*
def timeStart = new Date()
// Some code you want to time
def timeStop = new Date()
TimeDuration duration = TimeCategory.minus(timeStop, timeStart)
println duration
This will give you the time in hours, minutes, seconds
Nice post, thanks for sharing.
ReplyDelete