Groovy web console

subscribe to the feed Subscribe
to this
site
Pretty print time (via #groovywebconsole)
tweet this snippet Tweet
this
script

Pretty print time

Published 2 months ago by thyper with tags timecategory time
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
import groovy.time.TimeCategory

def start = new Date()
Thread.sleep(542)
def end = new Date()

use (TimeCategory) {
    println end - start
}