diff --git a/src/platform/esp32.rs b/src/platform/esp32.rs index 01fb38f..f1e3e7b 100644 --- a/src/platform/esp32.rs +++ b/src/platform/esp32.rs @@ -273,9 +273,9 @@ impl CircadianRhythm { adjusted_end.hour += 24; } - let start_time = start.hour * 60; - let end_time = end.hour * 60; - let now_time = hour * 60 + minute; + let start_time = (start.hour as u16).wrapping_mul(60); + let end_time = (end.hour as u16).wrapping_mul(60); + let now_time = (hour as u16).wrapping_mul(60).wrapping_add(minute as u16); let duration = end_time - start_time; let cur_duration = now_time - start_time;