I think I remember there being a way from kotlin c...
# multiplatform
s
I think I remember there being a way from kotlin common to access the equivalent of
System.currentTimeMillis()
. I can’t find it anywhere though. How do I do this?
k
You need to write an expect/actual for that, unless something has changed
s
I thought I saw something in the change log notes, but I guess I imagined that
a
Maybe Duration? It's experimental as of now and used for conversion, I believe.
l
Look in
kotlin.time
package since 1.3.50
s
I checked there @louiscad but couldn’t find it there.
i
kotlin.time
package doesn't have that function, but it can provide some alternatives dependending on what higher level task you need it for.
s
@ilya.gorbunov give me an idea of what you mean
i
I.e. why do you need
currentTimeMillis
?
s
so I can compare it to a server given timestmap to see if an auth token is expired
i
So it should be some source of time both server and client agree on? I'm afraid we have no such API in mpp standard library.
s
@ilya.gorbunov any news on when we can expect an mpp date library?
i
We'll show prototype as soon as it is ready.
s
@ilya.gorbunov you guys are actually developing it?
a
@spierce7 use
getCurrentMilliSeconds
from https://github.com/icerockdev/moko-core#current-milliseconds (if you work on mobile platforms)
👍 1
k
@ilya.gorbunov I’m curious about the date library. I’ve been working on a rough port of Java’s time library. If you’ve got something in the works currently I’d probably not put a lot more effort into it.