Parcourir la source

Fix deprecations

Thomas Dy il y a 8 ans
Parent
commit
3eff1eea08
2 fichiers modifiés avec 5 ajouts et 2 suppressions
  1. 3 1
      src/sensors/mod.rs
  2. 2 1
      src/wm/mod.rs

+ 3 - 1
src/sensors/mod.rs

@@ -9,6 +9,7 @@ use comm;
 use comm::Channel;
 use config::Config;
 use std::thread;
+use std::time::Duration;
 use self::battery::BatterySensor;
 use self::tp_battery::TPBatterySensor;
 use self::disk::DiskSensor;
@@ -49,6 +50,7 @@ pub fn sensors(tx: &Channel, config: &Config) {
     });
     tp_bat.map(|bats| sensors.insert(1, Box::new(TPBatterySensor::new(&bats))));
 
+    let delay = Duration::from_secs(1);
     loop {
         let status = sensors.iter_mut()
             .map(|sensor| {
@@ -62,7 +64,7 @@ pub fn sensors(tx: &Channel, config: &Config) {
             .collect::<Vec<String>>();
 
         comm::send(tx, "sensors", &reduce(status));
-        thread::sleep_ms(1000);
+        thread::sleep(delay);
     }
 }
 

+ 2 - 1
src/wm/mod.rs

@@ -6,12 +6,13 @@ use comm;
 use comm::Channel;
 use config::Config;
 use std::thread;
+use std::time::Duration;
 
 pub fn wait_for<F>(f: F) -> xcb::Window where F: Fn() -> xcb::Window {
     loop {
         let w = f();
         if w == 0 {
-            thread::sleep_ms(100);
+            thread::sleep(Duration::from_millis(100));
         }
         else {
             return w;