Skip to content

Reimplement Instant to measure time across suspend - #8

Merged
LtPeriwinkle merged 10 commits into
masterfrom
forked_instant
Sep 1, 2021
Merged

Reimplement Instant to measure time across suspend#8
LtPeriwinkle merged 10 commits into
masterfrom
forked_instant

Conversation

@LtPeriwinkle

@LtPeriwinkle LtPeriwinkle commented Sep 1, 2021

Copy link
Copy Markdown
Owner

Most of this implementation is directly taken from time.rs in the standard library. Critical differences being the use of:

The windows implementation of std::time::Instant uses QueryPerformanceCounter which already has the intended behavior. Therefore, on windows, MistInstant simply wraps an Instant. This wrapper is also made available by disabling the Instant feature flag in mist and mist-core, for use on platforms that do not support the extensions mentioned above.

resolves #7

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`
@LtPeriwinkle
LtPeriwinkle merged commit 5b24f53 into master Sep 1, 2021
@LtPeriwinkle
LtPeriwinkle deleted the forked_instant branch September 1, 2021 04:38
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.

Instant is not suitable for measuring time

1 participant