Restrict `duration` to accept only integral values

Rather than implicitly casting floating points to integrals, `duration` now
verifies its input to be integral via `static_assert`. This patch also
streamlines the implementation of `duration`, reducing its code size.