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

It's possible to observe time leaping forward when using a berg.clock.realtime #15

Open
colinbdclark opened this issue Nov 14, 2017 · 0 comments
Milestone

Comments

@colinbdclark
Copy link
Collaborator

A Bergson realtime clock initializes its time member to the current now time when it is constructed. However, by default, clocks don't start ticking (and thus regularly updating their time until the start() method has been called on them.

As a result, when start() is called, it will appear to clock observers as if time suddenly leaps forward from the creation time to the current time. This means that any events that were "optimistically" scheduled while the clock was not ticking, with the intention of their timers starting when the clock starts ticking, will actually be scheduled to occur right away.

This may be what users want, or it may not. It is probably advisable for users to either:

  • ensure that the clock is running constantly, or
  • avoid scheduling any events until the clock has started and the next onTick event fires.

Or, alternatively, perhaps a berg.scheduler instance should simply refuse to schedule any new events while its clock isn't ticking?

If not the latter, we should improve the documentation to ensure that this issue is noted and provide solutions for avoiding it.

colinbdclark added a commit that referenced this issue Dec 31, 2018
…lock restarts.

Refactors the audiocontext clock example.
Scheduler tests are still broken.
@colinbdclark colinbdclark added this to the 1.0.0 milestone Jan 4, 2019
colinbdclark added a commit that referenced this issue Jan 6, 2019
* master:
  Bumps version to 0.14.0
  Fixes gh-17: Allows users to specify an interval for repeating events.
  Fixes gh-23: Removes worker termination when the clock stops. Fixes bug in worker implementation where freq was not being read properly.
  Excludes older/non-standard browsers from testem list.
colinbdclark added a commit that referenced this issue Jan 8, 2019
Improves factoring of audioContextClock example.
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

No branches or pull requests

1 participant