chore: update todo list, add imports

- use std::time::{Duration, Instant} for convenience
This commit is contained in:
Timofey Gelazoniya 2024-09-06 02:50:05 +03:00
parent 46af703f1d
commit 42c3278f82
Signed by: zeldon
GPG Key ID: 047886915281DD2A
2 changed files with 6 additions and 5 deletions

View File

@ -43,6 +43,7 @@ To build, you must have [Rust](https://www.rust-lang.org/) and
- [ ] Force update devices button in tray menu - [ ] Force update devices button in tray menu
- [ ] Colored tray icons for different battery levels - [ ] Colored tray icons for different battery levels
- [x] Show log window button in tray menu - [x] Show log window button in tray menu
- [ ] Further reduce CPU usage by using Event Loop Proxy events (more info [here](https://github.com/tauri-apps/tray-icon/issues/83#issuecomment-1697773065))
- [ ] Prebuilt Binary - [ ] Prebuilt Binary
- [ ] Command Line Arguments for update frequency - [ ] Command Line Arguments for update frequency
- [ ] Support for other Razer Devices (I only have DeathAdder V3 Pro, so I won't be able to test it with other devices) - [ ] Support for other Razer Devices (I only have DeathAdder V3 Pro, so I won't be able to test it with other devices)

View File

@ -3,7 +3,7 @@ use std::{
rc::Rc, rc::Rc,
sync::{mpsc, Arc, Mutex}, sync::{mpsc, Arc, Mutex},
thread, thread,
time::Duration, time::{Duration, Instant},
}; };
use crate::manager::DeviceManager; use crate::manager::DeviceManager;
@ -18,8 +18,8 @@ use winapi::um::{
winuser::{self, ShowWindow}, winuser::{self, ShowWindow},
}; };
const BATTERY_UPDATE_INTERVAL: std::time::Duration = std::time::Duration::from_secs(60); const BATTERY_UPDATE_INTERVAL: Duration = Duration::from_secs(60);
const DEVICE_FETCH_INTERVAL: std::time::Duration = std::time::Duration::from_secs(5); const DEVICE_FETCH_INTERVAL: Duration = Duration::from_secs(5);
#[derive(Debug)] #[derive(Debug)]
pub struct MemoryDevice { pub struct MemoryDevice {
@ -194,7 +194,7 @@ impl TrayApp {
let menu_channel = MenuEvent::receiver(); let menu_channel = MenuEvent::receiver();
let mut last_update = std::time::Instant::now(); let mut last_update = Instant::now();
let update_interval = Duration::from_millis(100); let update_interval = Duration::from_millis(100);
event_loop.run(move |event, _, control_flow| { event_loop.run(move |event, _, control_flow| {
@ -237,7 +237,7 @@ impl TrayApp {
} }
} }
last_update = std::time::Instant::now(); last_update = Instant::now();
} }
} }
_ => (), _ => (),