]> git.lizzy.rs Git - rust.git/commitdiff
Fix timeout conversion
authorJ. Ryan Stinnett <jryans@gmail.com>
Thu, 12 Nov 2020 03:40:15 +0000 (03:40 +0000)
committerJ. Ryan Stinnett <jryans@gmail.com>
Thu, 12 Nov 2020 03:40:15 +0000 (03:40 +0000)
library/std/src/sys/unix/futex.rs

index 7ec3794d0b051f306b9586e3ca5077d3edf98f07..42ddc1d514ec756e90ca526f879ff25fc0f81025 100644 (file)
@@ -42,14 +42,13 @@ fn emscripten_futex_wait(
         ) -> libc::c_int;
     }
 
-    let timeout_ms = timeout.map(|d| d.as_millis());
     unsafe {
         emscripten_futex_wait(
             futex as *const AtomicI32,
             // `val` is declared unsigned to match the Emscripten headers, but since it's used as
             // an opaque value, we can ignore the meaning of signed vs. unsigned and cast here.
             expected as libc::c_uint,
-            timeout_ms.map_or(crate::f64::INFINITY, |d| d as libc::c_double),
+            timeout.map_or(crate::f64::INFINITY, |d| d.as_secs_f64() * 1000.0),
         );
     }
 }