Skip to content
This repository has been archived by the owner on Apr 30, 2021. It is now read-only.

MTP-764 DReAM: GlobalClock needs to trigger timers when FastForward() is being called #142

Merged
merged 8 commits into from
Jul 30, 2015

Conversation

bjorg
Copy link
Contributor

@bjorg bjorg commented Jul 30, 2015

Before, GlobalClock.FastForward() was only adding a time offset to the clock. Now it also triggers the timer callbacks instantaneously when they become due. This change removes the need to use AsyncUtil.Sleep() after a GlobalClock.FastForward() call to get the timers to fire and execute on a background thread.

In addition, there is also a GlobalClock.Suspend() now that makes it possible to stop the clock. This is useful to capture the current time before calling operations that store time internally and then be able to compare the timestamps later.

DO NOT USE THESE METHODS IN PRODUCTION!!!

bjorg added a commit that referenced this pull request Jul 30, 2015
MTP-764 DReAM: GlobalClock needs to trigger timers when FastForward() is being called
@bjorg bjorg merged commit 7f74845 into MindTouch:master Jul 30, 2015
@yurigorokhov
Copy link
Contributor

Lol
On Jul 30, 2015 4:21 PM, "Steve Bjorg" notifications@github.com wrote:

Before, GlobalClock.FastForward() was only adding a time offset to the
clock. Now it also triggers the timer callbacks instantaneously when they
become due. This change removes the need to use AsyncUtil.Sleep() after a
GlobalClock.FastForward() call to get the timers to fire and execute on a
background thread.

In addition, there is also a GlobalClock.Suspend() now that makes it
possible to stop the clock. This is useful to capture the current time
before calling operations that store time internally and then be able to
compare the timestamps later.

DO NOT USE THESE METHODS IN PRODUCTION!!!

You can view, comment on, or merge this pull request online at:

#142
Commit Summary

  • Call global-clock tick when fast-forwarding time.
  • GlobalClock.FastForward() now forces firing timers to execute on the
    current thread.
  • Increase FastForward() resolution.
  • GlobalClock.FastForward() can now be canceled based on an optional
    callback value.
  • Return current time from FastForward(). Useful when FastForward() is
    canceled by the callback.
  • Added GlobalClock.Suspend() to stop time when needed.
  • Code changes from code review.
  • Copied over methods from Deki that should be available in DReAM
    instead.

File Changes

Patch Links:


Reply to this email directly or view it on GitHub
#142.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants