MCPcopy Create free account
hub / github.com/Effect-TS/effect / advanceTo

Function advanceTo

packages/effect/src/testing/TestClock.ts:351–360  ·  view source on GitHub ↗
(timestamp: number)

Source from the content-addressed store, hash-verified

349 const initialMonotonicNanos = currentMonotonicNanos
350 const endTimestamp = step(currentTimestamp)
351 const advanceTo = (timestamp: number) => {
352 const deltaMillis = timestamp - currentTimestamp
353 if (deltaMillis > 0 && Number.isFinite(deltaMillis)) {
354 currentMonotonicNanos += BigInt(Math.round(deltaMillis * 1_000_000))
355 }
356 if (Number.isFinite(timestamp)) {
357 currentWallNanos = millisToNanos(timestamp)
358 }
359 currentTimestamp = timestamp
360 }
361 while (Arr.isArrayNonEmpty(sleeps)) {
362 if (Arr.lastNonEmpty(sleeps).timestamp > endTimestamp) break
363 const entry = sleeps.pop()!

Callers 1

TestClock.tsFile · 0.85

Calls 2

millisToNanosFunction · 0.85
BigIntInterface · 0.50

Tested by

no test coverage detected