@@ -40,6 +40,8 @@ function debugModule(module, runtime) {
4040 var recordedEvents = [];
4141 var asyncCallbacks = [];
4242 var watchTracker = Elm.Native.Debug.make(runtime).watchTracker;
43+ var timerOffset = 0;
44+ var now = 0;
4345
4446 function wrapNotify(id, v) {
4547 var timestep = Date.now();
@@ -68,7 +70,7 @@ function debugModule(module, runtime) {
6870 var cbObj = { func:func, delayMs:delayMs, timerId:0, executed:false };
6971 var timerId = setTimeout(function() {
7072 cbObj.executed = true;
71− func();
73+ func(timerOffset);
7274 }, delayMs);
7375 cbObj.timerId = timerId;
7476 asyncCallbacks.push(cbObj);
@@ -108,19 +110,25 @@ function debugModule(module, runtime) {
108110 recordedEvents = events.slice();
109111 }
110112
113+ function resetTimeOffset() {
114+ timerOffset = 0;
115+ }
116+
111117 function setPaused() {
112118 programPaused = true;
113119 clearAsyncCallbacks();
114120 tracePath.stopRecording();
121+ now = Date.now();
115122 }
116123
117124 function setContinue(position) {
125+ timerOffset += Date.now() - now;
118126 programPaused = false;
119127 if (position > 0) {
120128 // If we're not unpausing at the head, then we need to dump the
121129 // events that are ahead of where we're continuing.
122130 recordedEvents = recordedEvents.slice(0,position);
123− executeCallbacks(asyncCallbacks, false);
131+ executeCallbacks(asyncCallbacks, false, timerOffset);
124132 }
125133 tracePath.startRecording();
126134 }
@@ -165,6 +173,7 @@ function debugModule(module, runtime) {
165173 getRecordedEventAt: getRecordedEventAt,
166174 copyRecordedEvents: copyRecordedEvents,
167175 loadRecordedEvents: loadRecordedEvents,
176+ resetTimeOffset: resetTimeOffset,
168177 getPaused: getPaused,
169178 setPaused: setPaused,
170179 setContinue: setContinue,
@@ -188,7 +197,8 @@ function debuggerInit(debugModule, runtime, hotSwapState /* =undefined */) {
188197 debugModule.tracePath.clearTraces();
189198 debugModule.clearRecordedEvents();
190199 debugModule.setContinue(0);
191− executeCallbacks(debugModule.initialAsyncCallbacks, true);
200+ debugModule.resetTimeOffset();
201+ executeCallbacks(debugModule.initialAsyncCallbacks, true, 0);
192202 }
193203
194204 function pauseProgram() {
@@ -443,12 +453,12 @@ function tracePathInit(runtime, mainNode) {
443453}
444454
445455
446−function executeCallbacks(callbacks, reexecute) {
456+function executeCallbacks(callbacks, reexecute, offset) {
447457 callbacks.forEach(function(timer) {
448458 if (reexecute || !timer.executed) {
449459 var func = timer.func;
450460 timer.executed = true;
451− func();
461+ func(offset);
452462 }
453463 });
454464}