kevin.cianfarini
08/28/2025, 5:40 PMClock
and Instant
are about to go stable in the stdlib, is there any willingness to add a Clock implementation in the test coroutines artifact that reflects the current time of the test scheduler?kevin.cianfarini
08/28/2025, 5:41 PM@OptIn(ExperimentalCoroutinesApi::class)
@ExperimentalTime
private class TestClock(private val scheduler: TestCoroutineScheduler) : Clock {
override fun now() = Instant.fromEpochMilliseconds(scheduler.currentTime)
}
@ExperimentalTime
val TestScope.testClock: Clock get() = TestClock(testScheduler)
hfhbd
08/28/2025, 5:58 PMkevin.cianfarini
08/28/2025, 5:59 PM