Better implementation of timestamp rounding