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

Fix timer accuracy #722

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

fjtrujy
Copy link
Member

@fjtrujy fjtrujy commented Jan 21, 2025

Description

This PR fixes an existing issue #530.

The existing timer implementation was working almost right, the real issue was in the implementation _times in libcglue that was losing too much precision.
Additional changes have been made too:

  • Use TimerBusClock2USec for returning proper usecs in the _times function
  • Improve errno logic in the nanosleep function.
  • Improve the accuracy of the timer by reducing the GAP after the immediate equal interruption.
  • Improve variable names and comments in the timer.
  • Put back the error tolerance in the nanosleep example to 5ms as it was originally.

Additionally, I have also tested implementation with the program described here: #527 (comment)

Bigger diff: 24, requested: 9145, got: 9169

So everything looks to be right 👏

Closes #530

@fjtrujy
Copy link
Member Author

fjtrujy commented Jan 21, 2025

Pinging @davidgfnet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant