Skip to content

Commit

Permalink
Merge pull request #82 from elBoberido/iox2-80-fix-clocl-nanosleep-on…
Browse files Browse the repository at this point in the history
…-macos

iox2-#80 Fix 'clock_nanosleep' on macOS
  • Loading branch information
elBoberido authored Jan 12, 2024
2 parents 9e5113f + 4534b8a commit 1607c02
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
12 changes: 11 additions & 1 deletion doc/release-notes/iceoryx2-unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,32 @@

### Features

<!-- NOTE: Add new entries sorted by issue number to minimize the possibility of conflicts when merging. -->

* Example text [#1](https://github.com/eclipse-iceoryx/iceoryx2/issues/1)

### Bugfixes

* Example text [#1](https://github.com/eclipse-iceoryx/iceoryx2/issues/1)
<!-- NOTE: Add new entries sorted by issue number to minimize the possibility of conflicts when merging. -->

* Fix `clock_nanosleep` on macOS [#80](https://github.com/eclipse-iceoryx/iceoryx2/issues/80)

### Refactoring

<!-- NOTE: Add new entries sorted by issue number to minimize the possibility of conflicts when merging. -->

* Example text [#1](https://github.com/eclipse-iceoryx/iceoryx2/issues/1)

### Workflow

<!-- NOTE: Add new entries sorted by issue number to minimize the possibility of conflicts when merging. -->

* Example text [#1](https://github.com/eclipse-iceoryx/iceoryx2/issues/1)

### New API features

<!-- NOTE: Add new entries sorted by issue number to minimize the possibility of conflicts when merging. -->

* Example text [#1](https://github.com/eclipse-iceoryx/iceoryx2/issues/1)

### API Breaking Changes
Expand Down
9 changes: 3 additions & 6 deletions iceoryx2-pal/posix/src/macos/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,10 @@ pub unsafe fn clock_nanosleep(
}

let wait_time = if (now.tv_sec > (*rqtp).tv_sec)
|| (now.tv_sec == (*rqtp).tv_sec && now.tv_nsec > (*rqtp).tv_nsec)
|| (now.tv_sec == (*rqtp).tv_sec && now.tv_nsec >= (*rqtp).tv_nsec)
{
timespec {
tv_sec: 0,
tv_nsec: 0,
}
} else if now.tv_nsec < (*rqtp).tv_nsec {
return 0;
} else if now.tv_nsec <= (*rqtp).tv_nsec {
timespec {
tv_sec: (*rqtp).tv_sec - now.tv_sec,
tv_nsec: (*rqtp).tv_nsec - now.tv_nsec,
Expand Down

0 comments on commit 1607c02

Please sign in to comment.