mirror of
https://github.com/InsanusMokrassar/krontab.git
synced 2025-12-05 20:45:48 +00:00
add work with time zones
This commit is contained in:
23
src/commonTest/kotlin/dev/inmo/krontab/utils/TimeZoneTest.kt
Normal file
23
src/commonTest/kotlin/dev/inmo/krontab/utils/TimeZoneTest.kt
Normal file
@@ -0,0 +1,23 @@
|
||||
package dev.inmo.krontab.utils
|
||||
|
||||
import com.soywiz.klock.*
|
||||
import dev.inmo.krontab.builder.buildSchedule
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class TimeZoneTest {
|
||||
@Test
|
||||
fun testDifferentTimeZonesReturnsDifferentTimes() {
|
||||
val scheduler = buildSchedule { seconds { every(1) } }
|
||||
val now = DateTime.now()
|
||||
runTest {
|
||||
for (i in 0 .. 24) {
|
||||
val nowTz = now.toOffset(i.hours)
|
||||
val next = scheduler.next(nowTz)!!
|
||||
assertEquals(
|
||||
(nowTz + 1.seconds).utc.unixMillisLong, next.utc.unixMillisLong
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user