Skip to content

Commit 72dc2f7

Browse files
Fix time operations
1 parent a36718f commit 72dc2f7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,12 +348,12 @@ impl PyVM {
348348
mut self_: PyRefMut<'_, Self>,
349349
millis: u64,
350350
) -> Result<PyAsyncResultHandle, PyVMError> {
351+
let now = SystemTime::now()
352+
.duration_since(SystemTime::UNIX_EPOCH)
353+
.expect("Duration since unix epoch cannot fail");
351354
self_
352355
.vm
353-
.sys_sleep(
354-
Duration::from_millis(millis),
355-
None,
356-
)
356+
.sys_sleep(now + Duration::from_millis(millis), Some(now))
357357
.map(Into::into)
358358
.map_err(Into::into)
359359
}

0 commit comments

Comments
 (0)