Reimplement Instant to measure time across suspend - #8
Merged
Conversation
This is mostly stolen from the standard library, excepting the two changes necessary to measure time through suspend, `mach_continuous_time` and `CLOCK_BOOTTIME`. Only implements the `Instant` functions that I think I will need. Not even sure if this compiles everywhere yet, let alone if it works.
this restricts us to macos 10.12 or earlier for MistInstant. However, that came out just over 5 years ago, so I'm not too worried
now works as intended on a macos vm. cannot verify on actual hardware seeing as i have no mac
Currently I've only implemented the bare minimum for MistInstant, so framerate limiting still uses the version from `std`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Most of this implementation is directly taken from
time.rsin the standard library. Critical differences being the use of:CLOCK_BOOTTIMEclockid on Linux (requires >=2.6.39)mach_continuous_timeon macOS (requires >=10.12)The windows implementation of
std::time::InstantusesQueryPerformanceCounterwhich already has the intended behavior. Therefore, on windows,MistInstantsimply wraps anInstant. This wrapper is also made available by disabling theInstantfeature flag in mist and mist-core, for use on platforms that do not support the extensions mentioned above.resolves #7