fix rounding error when calculating time offsets