pal/hermit: saturate usleep
microseconds at u64::MAX
Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
This commit is contained in:
parent
687c8a1eab
commit
edeefc532f
@ -78,9 +78,10 @@ pub fn set_name(_name: &CStr) {
|
||||
#[inline]
|
||||
pub fn sleep(dur: Duration) {
|
||||
let micros = dur.as_micros() + if dur.subsec_nanos() % 1_000 > 0 { 1 } else { 0 };
|
||||
let micros = u64::try_from(micros).unwrap_or(u64::MAX);
|
||||
|
||||
unsafe {
|
||||
hermit_abi::usleep(micros as u64);
|
||||
hermit_abi::usleep(micros);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user