Avoid overflows better when calculating the interval wait time