mirror of
https://github.com/InsanusMokrassar/krontab.git
synced 2024-11-22 08:13:54 +00:00
fix in timezoned crontab scheduler
This commit is contained in:
parent
1c95636b71
commit
e3490d432e
@ -13,7 +13,7 @@ import com.soywiz.klock.DateTimeTz
|
||||
interface KronSchedulerTz : KronScheduler {
|
||||
suspend fun next(relatively: DateTimeTz): DateTimeTz?
|
||||
|
||||
override suspend fun next(relatively: DateTime): DateTime? = next(relatively.localUnadjusted) ?.local
|
||||
override suspend fun next(relatively: DateTime): DateTime? = next(relatively.local) ?.local
|
||||
}
|
||||
|
||||
suspend fun KronSchedulerTz.nextOrRelative(relatively: DateTimeTz): DateTimeTz = next(relatively) ?: getAnyNext(
|
||||
@ -31,4 +31,4 @@ suspend fun KronScheduler.next(relatively: DateTimeTz) = if (this is KronSchedul
|
||||
this.next(relatively.local) ?.toOffsetUnadjusted(relatively.offset)
|
||||
}
|
||||
|
||||
suspend fun KronScheduler.nextTimeZoned() = next(DateTime.now().local)
|
||||
suspend fun KronScheduler.nextTimeZoned() = next(DateTime.now().local)
|
||||
|
@ -1,5 +1,6 @@
|
||||
package dev.inmo.krontab.internal
|
||||
|
||||
import com.soywiz.klock.DateTime
|
||||
import com.soywiz.klock.DateTimeTz
|
||||
import com.soywiz.klock.TimezoneOffset
|
||||
import dev.inmo.krontab.KronScheduler
|
||||
@ -18,6 +19,10 @@ internal data class CronDateTimeSchedulerTz internal constructor(
|
||||
val dateTimeWithActualOffset = relatively.toOffset(offset).local
|
||||
return cronDateTime.toNearDateTime(dateTimeWithActualOffset) ?.toOffsetUnadjusted(offset) ?.toOffset(relatively.offset)
|
||||
}
|
||||
|
||||
override suspend fun next(relatively: DateTime): DateTime? {
|
||||
return next(relatively.toOffset(offset)) ?.utc
|
||||
}
|
||||
}
|
||||
|
||||
internal fun mergeCronDateTimeSchedulers(
|
||||
|
Loading…
Reference in New Issue
Block a user