use(TimeCategory) {(1.year + 2.months + 3.hours).toMilliseconds() }
Any suggestions on how to get that in seconds (maintaining the level of grooviness)?
You can add a closure to the groovy.time.TimeDatumDependentDuration
class to hide the conversion to seconds:
TimeDatumDependentDuration.metaClass.toSeconds = { delegate.toMilliseconds() / 1000 }
and then:
use(TimeCategory) { (1.year + 2.months + 3.hours).toSeconds() }
will return seconds.
+
operators don't count? ;-)