Since divBy is a constant, do this at compile time instead and instantiate a CeilDate/TimeExpression in the case of divBy == 1. Then you don't need this check. You can still do the nanos optimization, though, here