From 693474d5be5af831704495a378e6c4f8598148a7 Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Sun, 12 May 2019 22:17:11 +0200 Subject: [PATCH] fix(dc_job): dont subtract too much --- src/dc_job.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/dc_job.rs b/src/dc_job.rs index 49029d0d1..7400d3087 100644 --- a/src/dc_job.rs +++ b/src/dc_job.rs @@ -1235,8 +1235,12 @@ unsafe fn get_next_wakeup_time(context: &dc_context_t, thread: libc::c_int) -> D .duration_since(SystemTime::UNIX_EPOCH) .unwrap(); if t > 0 { - println!("{:?} {:?} {:?}", t, now, Duration::new(t, 0)); - wakeup_time = Duration::new(t, 0) - now; + let t = Duration::new(t, 0); + if t > now { + wakeup_time = t - now; + } else { + wakeup_time = Duration::new(0, 0); + } } }