platform: esp32: fix crash when hours wrap around
This commit is contained in:
parent
bf4ef46699
commit
e0491fafe8
@ -273,9 +273,9 @@ impl CircadianRhythm {
|
|||||||
adjusted_end.hour += 24;
|
adjusted_end.hour += 24;
|
||||||
}
|
}
|
||||||
|
|
||||||
let start_time = start.hour * 60;
|
let start_time = (start.hour as u16).wrapping_mul(60);
|
||||||
let end_time = end.hour * 60;
|
let end_time = (end.hour as u16).wrapping_mul(60);
|
||||||
let now_time = hour * 60 + minute;
|
let now_time = (hour as u16).wrapping_mul(60).wrapping_add(minute as u16);
|
||||||
|
|
||||||
let duration = end_time - start_time;
|
let duration = end_time - start_time;
|
||||||
let cur_duration = now_time - start_time;
|
let cur_duration = now_time - start_time;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user