[−][src]Function sunrise_libtimezone::utils::normalize_overflow
pub fn normalize_overflow<T>(ip: &mut T, unit: &mut T, base: T) -> bool where
T: Num + Sub<Output = T> + Div<Output = T> + Neg<Output = T> + CheckedAdd + SubAssign + PartialOrd + Copy,
Normalize and increment the given ip
with the given unit
and base
if it doesn't overflow.
If the operation overflow, this return true otherwise false.
Note:
The normalization part allows to remove (or in negative case, add) the amount of unit
that we are going to add (or in negative case, remove) to ip
.
e.g: This can be used to get the number of minutes in a given number of seconds and permit to catches possible overflow on the number of minutes.