Sanitise time, to prevent wrong values. Fixes #1778
Derp.