mirror of
https://github.com/InsanusMokrassar/krontab.git
synced 2024-11-22 16:23:55 +00:00
updates and fixes
This commit is contained in:
parent
7e58ec0873
commit
301afb1ee0
@ -10,6 +10,7 @@
|
|||||||
* New type `KronSchedulerTz`
|
* New type `KronSchedulerTz`
|
||||||
* `SchedulerFlow` has been deprecated
|
* `SchedulerFlow` has been deprecated
|
||||||
* New extension `asTzFlow` and small changes in `asFlow` logic
|
* New extension `asTzFlow` and small changes in `asFlow` logic
|
||||||
|
* `merge` extensions now return `CollectionKronScheduler` instead of just `KronScheduler`
|
||||||
|
|
||||||
## 0.5.1
|
## 0.5.1
|
||||||
|
|
||||||
|
@ -84,13 +84,10 @@ fun createSimpleScheduler(
|
|||||||
offsetParsed = offsetParsed ?: offsetFromString
|
offsetParsed = offsetParsed ?: offsetFromString
|
||||||
dayOfWeekParsed = dayOfWeekParsed ?: dayOfWeekFromString
|
dayOfWeekParsed = dayOfWeekParsed ?: dayOfWeekFromString
|
||||||
when {
|
when {
|
||||||
dayOfWeekFromString != null -> return@forEach
|
dayOfWeekFromString != null || offsetFromString != null -> return@forEach
|
||||||
offsetFromString == null && yearParsed == null -> {
|
yearParsed == null -> {
|
||||||
yearParsed = parseYears(it)
|
yearParsed = parseYears(it)
|
||||||
}
|
}
|
||||||
offsetFromString != null && offsetParsed == null -> {
|
|
||||||
offsetParsed = offsetFromString
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -150,4 +147,4 @@ fun KrontabTemplate.toKronScheduler(): KronScheduler = buildSchedule(this)
|
|||||||
/**
|
/**
|
||||||
* Shortcut for [buildSchedule]
|
* Shortcut for [buildSchedule]
|
||||||
*/
|
*/
|
||||||
fun KrontabTemplate.toKronScheduler(defaultOffset: Minutes): KronSchedulerTz = buildSchedule(this, defaultOffset)
|
fun KrontabTemplate.toKronScheduler(defaultOffset: Minutes): KronSchedulerTz = buildSchedule(this, defaultOffset)
|
||||||
|
@ -10,14 +10,17 @@ class TimeZoneTest {
|
|||||||
@Test
|
@Test
|
||||||
fun testDifferentTimeZonesReturnsDifferentTimes() {
|
fun testDifferentTimeZonesReturnsDifferentTimes() {
|
||||||
val scheduler = buildSchedule { seconds { every(1) } }
|
val scheduler = buildSchedule { seconds { every(1) } }
|
||||||
val now = DateTime.now()
|
val baseDate = DateTime.now().startOfWeek
|
||||||
runTest {
|
runTest {
|
||||||
for (i in 0 .. 24) {
|
for (i in 0 until 7) {
|
||||||
val nowTz = now.toOffset(i.hours)
|
val now = baseDate + i.days
|
||||||
val next = scheduler.next(nowTz)!!
|
for (j in 0 .. 24) {
|
||||||
assertEquals(
|
val nowTz = now.toOffset(j.hours)
|
||||||
(nowTz + 1.seconds).utc.unixMillisLong, next.utc.unixMillisLong
|
val next = scheduler.next(nowTz)!!
|
||||||
)
|
assertEquals(
|
||||||
|
(nowTz + 1.seconds).utc.unixMillisLong, next.utc.unixMillisLong
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user