Skip to content

Implement mach_timebase_info for macOS #1331

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

Merged
merged 4 commits into from
Apr 14, 2020

Conversation

samrat
Copy link
Contributor

@samrat samrat commented Apr 13, 2020

Since we return nanoseceonds instead of ticks from mach_absolute_time, we don't need to scale the absolute time

Fixes #1288

Since we return nanoseceonds instead of ticks from
`mach_absolute_time`, we don't need to scale the absolute time
@samrat
Copy link
Contributor Author

samrat commented Apr 13, 2020

@RalfJung Please let me know if you think the approach of always returning returning 1 for both numer and denom so as not to scale the value returned by mach_absolute_time is not the right way to go about this.

@RalfJung
Copy link
Member

Please let me know if you think the approach of always returning returning 1 for both numer and denom so as not to scale the value returned by mach_absolute_time is not the right way to go about this.

That is exactly the right way, yes. Indeed that's why I picked nanoseconds, I just was too lazy to also implement mach_timebase_info... and I figured this would make a great first PR for someone, so welcome. :D

@RalfJung
Copy link
Member

This looks great overall, I just have a few nits. :)

Also fix typo and remove newline
And add comment documenting successful return value from
`mach_timebase_info`.
@RalfJung
Copy link
Member

Awesome, thanks a lot. :D
@bors r+

@bors
Copy link
Contributor

bors commented Apr 14, 2020

📌 Commit fff45b7 has been approved by RalfJung

@bors
Copy link
Contributor

bors commented Apr 14, 2020

⌛ Testing commit fff45b7 with merge 669191b...

@bors
Copy link
Contributor

bors commented Apr 14, 2020

☀️ Test successful - checks-travis, status-appveyor
Approved by: RalfJung
Pushing 669191b to master...

@bors bors merged commit 669191b into rust-lang:master Apr 14, 2020
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.

macOS: cannot subtract Instants (mach_timebase_info not implemented)
4 participants