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

Make ftime return wall clock #4

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from

Conversation

StefanJum
Copy link
Member

@StefanJum StefanJum commented Feb 23, 2022

The problem was discussed here.

Return wall clock on calling ftime, since the
function is used in pte_relmillisecs to find
the time offset as milliseconds from the current
system time.

pte_relmillisecs returns timeout as milliseconds
from current system time, got by calling ftime here.
sem_timedwait calculates the time offset using
pte_relmillisecs here and then waits in a loop.

Using monotonic time results in a wrong offset
when using sem_timedwait that makes the abstime
argument be interpreted as a relative offset to
the monotonic clock start, not as an absolute value
since epoch.

Signed-off-by: Stefan Jumarea stefanjumarea02@gmail.com

Return wall clock on calling `ftime`, since the
function is used in `pte_relmillisecs` to find
the time offset as milliseconds from the current
system time.

`pte_relmillisecs` returns timeout as milliseconds
from current system time, got by calling `ftime`.
`sem_timedwait` calculates the time offset using
`pte_relmillisecs` and then waits in a loop.

Using monotonic time results in a wrong offset
when using `sem_timedwait` that makes the `abstime`
argument be interpreted as a relative offset to
the monotonic clock start, not as an absolute value
since epoch.

Signed-off-by: Stefan Jumarea <stefanjumarea02@gmail.com>
@razvand razvand requested a review from adinasm May 19, 2022 08:48
@razvand razvand self-assigned this May 19, 2022
Copy link

@adinasm adinasm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, seems like the bug is gone now.

Reviewed-by: Adina Smeu adina.smeu@gmail.com

@razvanvirtan razvanvirtan added this to the v0.11.0 (Janus) milestone Oct 6, 2022
@nderjung nderjung removed this from the v0.11.0 (Janus) milestone Feb 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🧊 Icebox
Development

Successfully merging this pull request may close these issues.

5 participants