mirror of
https://github.com/InsanusMokrassar/krontab.git
synced 2024-11-26 03:58:50 +00:00
fix tests
This commit is contained in:
parent
b4790b892a
commit
c3ed1d024c
@ -3,9 +3,7 @@
|
||||
## 0.6.1
|
||||
|
||||
* Versions
|
||||
* `Klock`: `2.1.0` -> `2.1.2
|
||||
|
||||
`
|
||||
* `Klock`: `2.1.0` -> `2.1.2`
|
||||
|
||||
## 0.6.0
|
||||
|
||||
|
@ -15,9 +15,16 @@ import kotlinx.coroutines.flow.*
|
||||
*/
|
||||
@FlowPreview
|
||||
fun KronScheduler.asTzFlow(): Flow<DateTimeTz> = channelFlow {
|
||||
var previousTime = DateTime.nowLocal()
|
||||
while (isActive) {
|
||||
val now = DateTime.now().local
|
||||
val now = DateTime.nowLocal()
|
||||
val nextTime = next(now) ?: break
|
||||
if (previousTime == nextTime) {
|
||||
delay(1L) // skip 1ms
|
||||
continue
|
||||
} else {
|
||||
previousTime = nextTime
|
||||
}
|
||||
val sleepDelay = (nextTime - DateTime.now().local).millisecondsLong
|
||||
delay(sleepDelay)
|
||||
send(nextTime)
|
||||
|
Loading…
Reference in New Issue
Block a user