about summary refs log tree commit diff
path: root/src/libstd/sys/unix/condvar.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/sys/unix/condvar.rs')
-rw-r--r--src/libstd/sys/unix/condvar.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libstd/sys/unix/condvar.rs b/src/libstd/sys/unix/condvar.rs
index 89a44b97657..4f878d8ad1f 100644
--- a/src/libstd/sys/unix/condvar.rs
+++ b/src/libstd/sys/unix/condvar.rs
@@ -92,14 +92,15 @@ impl Condvar {
         assert_eq!(r, 0);
 
         // Nanosecond calculations can't overflow because both values are below 1e9.
-        let nsec = dur.subsec_nanos() as libc::c_long + now.tv_nsec as libc::c_long;
+        let nsec = dur.subsec_nanos() + now.tv_nsec as u32;
+
         let sec = saturating_cast_to_time_t(dur.as_secs())
             .checked_add((nsec / 1_000_000_000) as libc::time_t)
             .and_then(|s| s.checked_add(now.tv_sec));
         let nsec = nsec % 1_000_000_000;
 
         let timeout = sec.map(|s| {
-            libc::timespec { tv_sec: s, tv_nsec: nsec }
+            libc::timespec { tv_sec: s, tv_nsec: nsec as _}
         }).unwrap_or(TIMESPEC_MAX);
 
         let r = libc::pthread_cond_timedwait(self.inner.get(), mutex::raw(mutex),