Return to Snippet

Revision: 16533
at August 7, 2009 08:36 by berndschiffer


Updated Code
def timeLogged (Closure c) {
    long start = - System.currentTimeMillis()
    c.call()
    println "duration in sec: " + (System.currentTimeMillis() + start) / 1000;
}

def tueA() { tue('a') }
def tueB() { tue('b') }
def tueC() { tue('c') }

def tue(was) {
	println was
	sleep(100)
}

timeLogged { tueA() }
timeLogged { tueB() }
timeLogged { tueC() }

Revision: 16532
at August 7, 2009 08:17 by berndschiffer


Initial Code
def timeLogged (Closure c) {
    long start = - System.currentTimeMillis()
    c.call()
    println "duration in sec: " + (System.currentTimeMillis() + start) / 1000;
}

def tueA() { tue('a') }
def tueB() { tue('b') }
def tueC() { tue('c') }

def tue(was) {
	println was
	sleep(100)
}

timeLogged { tueA() }
timeLogged { tueB() }
timeLogged { tueC() }

Initial URL
http://berndschiffer.blogspot.com/2009/08/beispiel-fur-refactoring-von-beispiel.html

Initial Description

                                

Initial Title
Stefans Lösung

Initial Tags
textmate, groovy

Initial Language
Groovy