|
|
@ -0,0 +1,18 @@ |
|
|
|
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." |
|
|
|
} |