We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3ae8f94 commit c8d5a32Copy full SHA for c8d5a32
services/power-panic/src/main.rs
@@ -78,16 +78,16 @@ async fn main() -> Result<()> {
78
let battery = get_battery_info().await?;
79
println!("Battery: {:?}", battery);
80
81
- let mut time_to_sleep = 60;
+ let mut time_to_sleep = Duration::from_secs(60);
82
83
let battery_is_low = battery.charge < 0.20;
84
let battery_is_charging = battery.current > 0.0;
85
86
if battery_is_low && !battery_is_charging {
87
audio_player.play();
88
- time_to_sleep = (battery.charge * 100.0) as u64;
+ time_to_sleep = Duration::from_secs((battery.charge * 100.0) as u64);
89
}
90
91
- sleep(Duration::from_secs(time_to_sleep));
+ sleep(time_to_sleep);
92
93
0 commit comments