1#[cfg(target_os = "linux")]
23mod linux;
24#[cfg(target_os = "windows")]
25mod win;
26#[cfg(target_os = "macos")]
27mod macos;
28
29#[cfg(target_os = "linux")]
30use linux::get_idle_time as plat_idle_time;
31#[cfg(target_os = "windows")]
32use win::get_idle_time as plat_idle_time;
33#[cfg(target_os = "macos")]
34use macos::get_idle_time as plat_idle_time;
35
36#[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))]
38pub fn get_idle_time() -> Result<std::time::Duration, Box<dyn std::error::Error>> {
39 plat_idle_time()
40}
41
42#[cfg(not(any(target_os = "linux", target_os = "windows", target_os = "macos")))]
43pub fn get_idle_time() -> Result<std::time::Duration, Box<dyn std::error::Error>> {
44 Err("Unsupported platform".into())
45}