Florian
08/20/2021, 5:21 PMdelay
to take longer than the specified time?
And do you think this will work to get the actual passed time after a delay (for example for a countdown timer)?
val timeBefore = SystemClock.elapsedRealtime()
delay(TICK_DELAY)
val timeAfter = SystemClock.elapsedRealtime()
val passedTime = timeAfter - timeBefore
louiscad
08/20/2021, 5:57 PMmeasureTime { }
from the stdlib should suit your needs.
If the Dispatcher, or the VM/machine is short on resources, as can be seen when your computer freezes, the actual delay will be longer than requested.Florian
08/20/2021, 7:44 PMmeasureTime
seems useful!