From 61d61fdf722e0e058a606b642bbff5dcae3d877e Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Tue, 13 Jan 2026 18:33:00 +0000 Subject: [PATCH] Attempt to fix clock types unavailable in embedded mode --- .../JavaScriptEventLoop+ExecutorFactory.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Sources/JavaScriptEventLoop/JavaScriptEventLoop+ExecutorFactory.swift b/Sources/JavaScriptEventLoop/JavaScriptEventLoop+ExecutorFactory.swift index 574e8d03a..8df536720 100644 --- a/Sources/JavaScriptEventLoop/JavaScriptEventLoop+ExecutorFactory.swift +++ b/Sources/JavaScriptEventLoop/JavaScriptEventLoop+ExecutorFactory.swift @@ -34,6 +34,16 @@ extension JavaScriptEventLoop: SchedulingExecutor { tolerance: C.Duration?, clock: C ) { +#if hasFeature(Embedded) + // Hand-off the scheduling work to Clock implementation for unknown clocks + clock.enqueue( + job, + on: self, + at: clock.now.advanced(by: delay), + tolerance: tolerance + ) + return +#else let duration: Duration // Handle clocks we know if let _ = clock as? ContinuousClock { @@ -55,6 +65,7 @@ extension JavaScriptEventLoop: SchedulingExecutor { UnownedJob(job), withDelay: milliseconds ) +#endif } private static func delayInMilliseconds(from swiftDuration: Duration) -> Double {