MichaĆ Kalinowski
10/16/2022, 10:04 PMDelay
use millis time(scheduleResumeAfterDelay) instead of more accurate Duration
? For now there is no way to pass Duration to UI dispatcher which is accurate, i.e don't make errors with rounding đJacob
10/16/2022, 10:42 PMJacob
10/16/2022, 10:48 PMlouiscad
10/17/2022, 12:29 AMMichaĆ Kalinowski
10/17/2022, 6:54 AMMichaĆ Kalinowski
10/17/2022, 7:00 AMgildor
10/17/2022, 7:19 AMMichaĆ Kalinowski
10/17/2022, 7:41 AMlouiscad
10/17/2022, 7:44 AMgildor
10/17/2022, 8:23 AMMichaĆ Kalinowski
10/17/2022, 9:02 AMgildor
10/17/2022, 9:03 AMMichaĆ Kalinowski
10/17/2022, 9:04 AMgildor
10/17/2022, 9:07 AMgildor
10/17/2022, 9:09 AMMichaĆ Kalinowski
10/17/2022, 9:10 AMgildor
10/17/2022, 9:12 AMlong frameTimeNanos
is to tell you exact frame time rendering from callback
You cannot tell it âdo this in x nanoseconds + frame renderingâ only âdo this in x milliseconds + frame renderingMichaĆ Kalinowski
10/17/2022, 9:20 AMVsevolod Tolstopyatov [JB]
10/17/2022, 9:57 AMkotlinx.coroutines
functions provide fooMs: Long
instead of Duration
simply because such API predates existence of Duration
class. We have a preliminary decision that all new time-related API will only accept Duration
and not Long
, but we are not sure we are ready to migrate existing users from it (well, maybe until https://youtrack.jetbrains.com/issue/KT-54106 is implemented).
Regarding the precision â yes, it couldâve been better in general (i.e. the default Delay
implementation delegates the precision to Thread.sleep(ms, ns)
and bounded by the underlying OS precision).
For UI systems (e.g. Android, JavaFx, Swing), most of the underlying API accepts millis: Long
anyway, and probably thatâs the reason this topic was never actively discussed