-
Notifications
You must be signed in to change notification settings - Fork 216
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
Add time.monotonic #787
base: master
Are you sure you want to change the base?
Add time.monotonic #787
Conversation
This comment is non-essential to review+merge this PR.P.S. My apologies for remaking #765 - I wanted to be proactively helpful and update this to fix the spurious merge conflict that got introduced by other upstream changes. But since I had deleted the fork from my account (I don't like having forks sitting around on my GitHub), recreating the pull request seemed to be the only way for me to do so. But to be clear, I still really don't want forks sitting around on my GitHub account, and after not getting any response on that copy of this trivial PR for seven months, I'm not feeling very optimistic or patient about it being worth it to do so, so we're now in the same state: the fork is already gone from my account and thus I can't update this PR. The difference this time is that I won't be recreating a third time, unless I get some explicit signal that the help is actually wanted. |
This comment is non-essential to review+merge this PR.Every once in a while I think "maybe it is worth it to have one or more tests for this", but what, exactly, would such tests be proving? We don't want to be testing the behavior of I presume we don't want Transcrypt to be in the business of implementing
I also don't know of any differences in browser APIs, now or on the horizon, which would force a more complex implementation of I also don't think Transcrypt wants to be in the business of supporting old browsers which don't have So what exactly is the testable surface area? That we didn't make a typo? That someone didn't accidentally delete or add a line or a character? That sounds silly, but I do see the value of that - it's a good safety railing to have against accidents. So we could do a one-liner test int(time.monotonic()) <= int(performance.now() / 1000) I didn't initially put that in because it seems like it's almost redundant, and it takes more work to verify that the test is appropriately scoped and correct than to just verify the code itself. But I will gladly go ahead and add that if I get an explicit statement that this is wanted. And I'm open to other suggestions about what's worth testing, because maybe I'm missing something in my above reasoning. That's why my initial description of #765 that I wrote back in December 2020 said
|
This comment is non-essential to review+merge this PR.
Case in point: I don't remember if Knowing me, I probably checked that when I first wrote that example test line. But right now I don't remember. And if it's not guaranteed, then that test is just wrong/unreliable/nondeterministic. In the amount of time it even took me to remember this possibility, I can validate that this |
Added
time.monotonic
as suggested in #699 - it is a trivial one-line implementation based onperformance.now
.The docstring is a simplified version of the official Python documentation.