diff --git a/iceoryx2-bb/elementary/src/alignment.rs b/iceoryx2-bb/elementary/src/alignment.rs index aa237e620..93d3341c0 100644 --- a/iceoryx2-bb/elementary/src/alignment.rs +++ b/iceoryx2-bb/elementary/src/alignment.rs @@ -34,19 +34,19 @@ pub struct Alignment(usize); impl Alignment { - pub const ALIGNMENT_1: Alignment = Alignment(1); - pub const ALIGNMENT_2: Alignment = Alignment(2); - pub const ALIGNMENT_4: Alignment = Alignment(4); - pub const ALIGNMENT_8: Alignment = Alignment(8); - pub const ALIGNMENT_16: Alignment = Alignment(16); - pub const ALIGNMENT_32: Alignment = Alignment(32); - pub const ALIGNMENT_64: Alignment = Alignment(64); - pub const ALIGNMENT_128: Alignment = Alignment(128); - pub const ALIGNMENT_256: Alignment = Alignment(256); - pub const ALIGNMENT_512: Alignment = Alignment(512); - pub const ALIGNMENT_1024: Alignment = Alignment(1024); - pub const ALIGNMENT_2048: Alignment = Alignment(2048); - pub const ALIGNMENT_4096: Alignment = Alignment(4096); + pub const ALIGN_1: Alignment = Alignment(1); + pub const ALIGN_2: Alignment = Alignment(2); + pub const ALIGN_4: Alignment = Alignment(4); + pub const ALIGN_8: Alignment = Alignment(8); + pub const ALIGN_16: Alignment = Alignment(16); + pub const ALIGN_32: Alignment = Alignment(32); + pub const ALIGN_64: Alignment = Alignment(64); + pub const ALIGN_128: Alignment = Alignment(128); + pub const ALIGN_256: Alignment = Alignment(256); + pub const ALIGN_512: Alignment = Alignment(512); + pub const ALIGN_1024: Alignment = Alignment(1024); + pub const ALIGN_2048: Alignment = Alignment(2048); + pub const ALIGN_4096: Alignment = Alignment(4096); /// Creates a new [`Alignment`]. If the value is zero or not a power of 2 /// it returns [`None`]. diff --git a/iceoryx2-pal/posix/src/windows/time.rs b/iceoryx2-pal/posix/src/windows/time.rs index 9e3ce42a2..53127b742 100644 --- a/iceoryx2-pal/posix/src/windows/time.rs +++ b/iceoryx2-pal/posix/src/windows/time.rs @@ -59,10 +59,13 @@ pub unsafe fn clock_nanosleep( return Errno::EINVAL as _; } - let time = Duration::from_secs((*rqtp).tv_sec as _) - + Duration::from_nanos((*rqtp).tv_nsec as _) - - now.unwrap(); + let future_time_point = + Duration::from_secs((*rqtp).tv_sec as _) + Duration::from_nanos((*rqtp).tv_nsec as _); + + if now < future_time_point { + let sleep_time = future_time_point - now.unwrap(); + std::thread::sleep(time); + } - std::thread::sleep(time); Errno::ESUCCES as _ }