@fireemu/darwin-arm64 0.60.0 → 0.62.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 +1 -1
- package/bin/fireemu +2 -2
- package/bin/runner-node/clock.mjs +27 -10
- package/package.json +1 -1
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.
|
|
4
|
+
(Rust target `aarch64-apple-darwin`), version 0.62.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:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 37907760 bytes
|
|
4
|
+
sha256: 5dca36a111818e9f4a7e541d1e03d60a9551a51b69d5fbe1bb6357278228873e
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
//
|
|
248
|
-
|
|
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();
|