Browse Source

Handle timeout int conversion better

pull/86/head
AzureMarker 1 year ago
parent
commit
323538bcff
  1. 11
      ctru-rs/src/services/srv.rs

11
ctru-rs/src/services/srv.rs

@ -16,11 +16,14 @@ pub trait HandleExt { @@ -16,11 +16,14 @@ pub trait HandleExt {
impl HandleExt for Handle {
fn wait_for_event(self, timeout: Duration) -> crate::Result<()> {
let timeout = i64::try_from(timeout.as_nanos()).map_err(|e| {
crate::Error::Other(format!(
"Failed to convert timeout to 64-bit nanoseconds: {}",
e
))
})?;
unsafe {
ResultCode(ctru_sys::svcWaitSynchronization(
self,
timeout.as_nanos() as i64,
))?;
ResultCode(ctru_sys::svcWaitSynchronization(self, timeout))?;
}
Ok(())
}

Loading…
Cancel
Save