Micros overflows every ~71.5 minutes. This can cause the newTime value to get stuck at a very high value while Micros rolls back to 0. When this happens the while condition in the sample loop is not met for a very long time. Changing the while condition to check for the difference between the two unsigned longs prevents this possibility (a negative outcome is not possible as there is no sign).
Micros overflows every ~71.5 minutes. This can cause the newTime value to get stuck at a very high value while Micros rolls back to 0. When this happens the while condition in the sample loop is not met for a very long time. Changing the while condition to check for the difference between the two unsigned longs prevents this possibility (a negative outcome is not possible as there is no sign).