Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: posix: nanosleep: fix nanosleep for sub microsecond durations #28542

Merged
merged 2 commits into from
Oct 2, 2020
Merged

lib: posix: nanosleep: fix nanosleep for sub microsecond durations #28542

merged 2 commits into from
Oct 2, 2020

Commits on Sep 22, 2020

  1. lib: posix: nanosleep: round up to the nearest microsecond

    We must round up to the nearest microsecond in order to fulfill the
    nanosleep(2) API requirement of sleeping for *at least* that many
    nanoseconds.
    
    The only platform with an upper-bound check right now is Nordic.
    
    Fixes #28483
    
    Signed-off-by: Christopher Friedt <[email protected]>
    cfriedt committed Sep 22, 2020
    Configuration menu
    Copy the full SHA
    0f9a8d5 View commit details
    Browse the repository at this point in the history
  2. tests: posix: nanosleep: round up to the nearest microsecond

    Here, we include some addtional tests for durations that have
    sub-microsecond components.
    
    1ns => k_busy_wait(0). Round to 1us.
    1us + 1ns => k_busy_wait(1us). Round to 2us.
    1s + 1ns => k_busy_wait(1000000us). Round to 1000001us.
    1s + 1us + 1ns => k_busy_wait(1000001us). Round to 1000002us.
    
    Fixes #28483
    
    Signed-off-by: Christopher Friedt <[email protected]>
    cfriedt committed Sep 22, 2020
    Configuration menu
    Copy the full SHA
    80b8b6e View commit details
    Browse the repository at this point in the history