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

New version of systemTime that returns an Int representing microseconds #2418

Merged
merged 10 commits into from
Sep 25, 2021

Conversation

alvaroc1
Copy link
Contributor

@alvaroc1 alvaroc1 commented Sep 18, 2021

Resolves #2359

Tests pass and have used the new function successfully (i hacked the previous version for the test), but will require an update of base.

Base refers to systemTime.impl which is a built-in, but i'm not sure how that connects to systemTime.impl.v3, i'm guessing something else needs to be wired (?)

@atacratic
Copy link
Contributor

Hooray! ☺️

But looks like impl just multiplies by a million, and can't actually work out the time to precision better than a second?

@alvaroc1
Copy link
Contributor Author

alvaroc1 commented Sep 18, 2021

Hooray! ☺️

But looks like impl just multiplies by a million, and can't actually work out the time to precision better than a second?

My very limited understanding is that getPOSIXTime produces something equivalent to a Real (?) or a Float representing seconds including fractions of a second. Multiplying it by a million turns it to microseconds and something later turns it into Int.

My animation code depends on it having microsecond resolution, and seems to work fine at least when rendering 30 fps, which makes me think the code is correct. But i can't claim to understand all the details :/

@atacratic
Copy link
Contributor

Oh magic, OK, nice one, sorry for misunderstanding!

Cheers for doing this 👍

Copy link
Member

@pchiusano pchiusano left a comment

Choose a reason for hiding this comment

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

Great! Left a couple comments though.

parser-typechecker/src/Unison/Builtin.hs Outdated Show resolved Hide resolved
parser-typechecker/src/Unison/Runtime/Builtin.hs Outdated Show resolved Hide resolved
@pchiusano
Copy link
Member

Also anytime you update the builtins, run stack exec transcripts after. CI checks that transcript output hasn't changed, and the set of builtins affects some transcript output.

Copy link
Member

@pchiusano pchiusano left a comment

Choose a reason for hiding this comment

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

Great!

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.

systemTime is returning seconds when it should be returning nanoseconds
4 participants