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

ban new Date.getTime() #2857

Merged
merged 1 commit into from
Sep 17, 2020

Conversation

mad-gooze
Copy link
Contributor

Hi!

This request forces shaka-player to use Date.now() for time calculations.

First point here is that this is faster than new Date().getTime().

Second point is that it allows monkey-patching Date.now() in runtime.

We are having issues with using Date.now() for time calculations (Date.now is not monotonic because it's affected by system time changes).
We are are going to monkey-patch Date.now() by using offset returned by performance.now() so it becomes monotonic and this patch makes this change consistent in our code and shaka-player.

@shaka-bot
Copy link
Collaborator

All tests passed!

@joeyparrish joeyparrish merged commit ee5fe52 into shaka-project:master Sep 17, 2020
matEhickey pushed a commit to matEhickey/shaka-player that referenced this pull request Sep 25, 2020
Date.now should be used instead, to allow applications to monkey-patch it.
matEhickey pushed a commit to matEhickey/shaka-player that referenced this pull request Sep 25, 2020
Date.now should be used instead, to allow applications to monkey-patch it.
joeyparrish pushed a commit that referenced this pull request Sep 29, 2020
Date.now should be used instead, to allow applications to monkey-patch it.
joeyparrish pushed a commit that referenced this pull request Oct 1, 2020
Date.now should be used instead, to allow applications to monkey-patch it.

Backported to v2.5.x

Change-Id: I40b287a4d39887d6b3ac9907e2233aec39c69add
@github-actions github-actions bot added the status: archived Archived and locked; will not be updated label Jul 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants