@fireemu/darwin-arm64 0.59.0 → 0.61.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # @fireemu/darwin-arm64
2
2
 
3
3
  The [fireemu](https://www.npmjs.com/package/fireemu) daemon built for `darwin-arm64`
4
- (Rust target `aarch64-apple-darwin`), version 0.59.0.
4
+ (Rust target `aarch64-apple-darwin`), version 0.61.0.
5
5
 
6
6
  macOS 13 or newer on Apple silicon.
7
7
 
package/bin/fireemu CHANGED
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/bin/fireemu
3
- size: 38683904 bytes
4
- sha256: 25639070b74054ab21f6a8fa4e6901f7a131ce460fb50364a76022ecc0625cee
3
+ size: 37874704 bytes
4
+ sha256: f6e83cb7ecd8ed62860ecce3e1cdf7b9b91987e78df68cdad72174bcdb98f46a
@@ -64,7 +64,16 @@ export function createRuntimeClock({date = 'real', timers: timerPolicy = 'real',
64
64
  let autoHandle = null;
65
65
  let autoDrain = null;
66
66
  const live = () => following ? process.hrtime.bigint() - anchor : 0n;
67
- const currentElapsed = () => elapsed + live();
67
+ // The daemon's elapsed time at its last update (it only counts forward moves), and the most
68
+ // this runner had already counted then: a freeze that arrives after the runner ran on past the
69
+ // daemon's frozen instant must not take timer time back, so time stays at that floor until the
70
+ // daemon catches up.
71
+ let daemonElapsed = elapsed;
72
+ let elapsedFloor = elapsed;
73
+ const currentElapsed = () => {
74
+ const counted = elapsed + live();
75
+ return counted > elapsedFloor ? counted : elapsedFloor;
76
+ };
68
77
  let sequence = 0;
69
78
  let draining = false;
70
79
  const queue = new Map();
@@ -157,7 +166,8 @@ export function createRuntimeClock({date = 'real', timers: timerPolicy = 'real',
157
166
  }
158
167
 
159
168
  function now() {
160
- if (!following) return epochMillis;
169
+ // What was shown stays the floor until the daemon reaches it or rewinds the clock.
170
+ if (!following) return Math.max(epochMillis, lastShown);
161
171
  const value = milliseconds(instant + live());
162
172
  lastShown = Math.max(lastShown, value);
163
173
  return lastShown;
@@ -239,18 +249,25 @@ export function createRuntimeClock({date = 'real', timers: timerPolicy = 'real',
239
249
  update(value) {
240
250
  const next = nanos(value.instantNanos, 'instant');
241
251
  const nextMillis = date === 'virtual' ? milliseconds(next) : 0;
242
- const nextElapsed = value.elapsedNanos === undefined
243
- ? elapsed + (next > instant ? next - instant : 0n)
244
- : nanos(value.elapsedNanos, 'elapsed');
245
- if (nextElapsed < elapsed) throw new RangeError('timer elapsed time cannot rewind');
246
- // A tick that lands slightly behind what was already shown does not step Date back; a
247
- // rewind (a move back by more than a second) does.
248
- if (date === 'virtual' && nextMillis < lastShown - 1000) lastShown = -Infinity;
252
+ const given = value.elapsedNanos !== undefined;
253
+ const nextElapsed = given
254
+ ? nanos(value.elapsedNanos, 'elapsed')
255
+ : daemonElapsed + (next > instant ? next - instant : 0n);
256
+ if (nextElapsed < daemonElapsed) throw new RangeError('timer elapsed time cannot rewind');
257
+ // The daemon counts only forward moves as elapsed time, so the instant moving less than
258
+ // the elapsed time is a rewind, which Date shows. Anything else (a tick, a freeze that
259
+ // arrives late) never steps Date back: what was shown stays the floor. Without the elapsed
260
+ // time, a move back by more than a second counts as a rewind.
261
+ const rewound = given
262
+ ? next - instant < nextElapsed - daemonElapsed
263
+ : date === 'virtual' && nextMillis < lastShown - 1000;
264
+ if (rewound) lastShown = -Infinity;
265
+ elapsedFloor = currentElapsed();
249
266
  if (value.following !== undefined) following = value.following === true;
250
- if (!following) lastShown = -Infinity;
251
267
  instant = next;
252
268
  epochMillis = nextMillis;
253
269
  elapsed = nextElapsed;
270
+ daemonElapsed = nextElapsed;
254
271
  anchor = process.hrtime.bigint();
255
272
  arm();
256
273
  return status();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fireemu/darwin-arm64",
3
- "version": "0.59.0",
3
+ "version": "0.61.0",
4
4
  "description": "The fireemu daemon for darwin-arm64",
5
5
  "homepage": "https://fireemu.github.io/fireemu/",
6
6
  "repository": {