Is there any appetite for a test artifact which ex...
# kotlinx-datetime
k
Is there any appetite for a test artifact which exposes some simple and common implementations of
Clock
? Maybe they could be as simple as:
Copy code
class StaticFakeClock(private val now: Instant) {
  override fun now(): Instant = now
}

class DynamicFakeClock(val times: ArrayDeque<Instant>) {
  override fun now(): Instant = times.removeFirst()
}
This could potentially also provide reference implementations for a clock that integrates with the coroutines test time source? That seems to be a really common question that pops up in this slack.
👀 3
🍔 1
sqldelight 1
1
p
The reality is this artifact will probably contain only 1 interfaces or 2. Nothing a developer couldn't do.
k
Yup that’s why I’m asking if there’s appetite for it 🙂
😁 1
🍲 1
t
I think it never hurts to have it! If it’s helpful for a few people it’s already worth it 😄
c
If you want a clock that uses the kotlinx-coroutines-test controlled time: https://gitlab.com/opensavvy/pedestal/-/blob/main/cache/src/commonTest/kotlin/TestClock.kt?ref_type=heads
It's a shame it's not documented anywhere, but it's really 5 lines so I understand they don't want to create a library just for that
1
d
I always find statements like “this is indeed useful, and will work fine.” to be disturbing. Who is this individual to tell you what you do and do not find useful? As if your perception of what makes something useful has to be deemed useful by him for it to be true. Is it just me or is that a bit insensitive?
c
@dewildte Was this supposed to be in another thread? I don't understand which message it responds to
d
I was talking about the conversation being had in the PR posted.
k
@hfhbd I dropped two comments in your PR advocating for the inclusion of your PR in a kotlinx-datetime-test artifact. We’ll see what the maintainers say.