Misc. experiments in groovy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
import groovy.time.TimeCategory
rt = Runtime.getRuntime() threads = rt.availableProcessors()
def now = new Date() def then = new Date().parse('yyyy-MM-dd-hh','2015-09-23-18') def cruise = Calendar.instance cruise.set(2015,9,5,16,0,0)
use TimeCategory, { println "Current DateTime: " + now def c = then - now def b = cruise.time - now println "My contract ends in ${c.days.intdiv(7)} weeks, ${c.days % 7} days, ${c.hours +1} hours." print "Our Bahama cruise leaves the port in " println "${b.days.intdiv(7)} weeks, ${b.days % 7} days, ${b.hours} hours, and ${b.minutes} minutes." }
|